SELECT

Choose which columns to read from a table, and in what order.

Syntax

SELECT column_list FROM table_name;
  • Use * for every column, or list the names you need, separated by commas.

Example

SELECT first_name, last_name, city FROM customers;

One row per customer, with three columns.

Tables used: customers. Try it in a lesson below.

Common mistakes

  • `SELECT *` is fine for exploring a table. In a query you keep, list the columns you need.
  • A column alias (`AS name`) only renames the output. It does not change the table.

Practise it