DATABASE (2ND YEAR 3RD TERM)

Subdecks (1)

Cards (68)

  • INTRODUCTION TO COMPUTING
  • Course Code: CCINCOM/L
  • Joseph Marvin R. Imperial
  • NU College of Computing and Information Technologies
  • SELECT QUERY
  • Lord Edgardian J. Tavu, MSCS
  • CS Program Chair
  • ADVANCED DATABASE SYSTEMS
  • Course Code: CTADVDBL
  • Department of Computer Science
  • College of Computing and Information Technologies (CCIT)
  • National University
  • SELECT query

    Specifies the columns to be retrieved as a column list
  • Syntax for a basic SELECT query

    1. SELECT columnlist
    2. FROM tablelist
  • columnlist
    One or more attributes, separated by commas
  • Wildcard character (*)

    Symbol that can be used as a general substitute for other characters or commands, meaning "all columns"
  • SQL Data Manipulation Commands
  • SQL Data Manipulation Commands

    • SELECT
    • FROM
    • WHERE
    • GROUP BY
    • HAVING
    • ORDER BY
  • SELECT
    Selects attributes from rows in one or more tables or views
  • FROM
    Specifies the tables from which data should be retrieved
  • WHERE
    Restricts the selection of rows based on a conditional expression
  • GROUP BY
    Groups the selected rows based on one or more attributes
  • HAVING
    Restricts the selection of grouped rows based on a condition
  • ORDER BY
    Orders the selected rows based on one or more attributes
  • Column alias
    New name specified for a column, used as a label or heading in the query output
  • Computed column
    Derived attribute, may or may not be stored in the database
  • Arithmetic operators

    +, -, *, /, ^
  • Rules of precedence

    • Perform operations within parentheses
    • Perform power operations
    • Perform multiplications and divisions
    • Perform additions and subtractions
  • Comparison operators
    • =, <, >, <=, >=, <>, !=
  • Logical operators

    • AND, OR, NOT
  • Aggregate functions

    • COUNT, MIN, MAX, SUM, AVG
  • Special operators

    • BETWEEN, IN, LIKE, IS NULL, EXISTS, DISTINCT
  • DISTINCT
    Limits values to unique values
  • Nulls can be problematic when writing SQL code as different operators and functions treat nulls differently