3.9 SQL: Components of a query

  • SELECT columns
  • FROM a table in a database
  • WHERE rows meet a condition
  • GROUP BY values of a column
  • ORDER BY values of a column when displaying results
  • LIMIT to only X number of rows in resulting table
  • Always required: SELECT and FROM. Rest are optional.
  • SELECT can be combined with operators such as SUM, COUNT, AVG
  • To merge multiple tables, you can use JOIN