SQL SELECT, explained

Every SQL query that reads data starts with SELECT. You tell the database which columns you want, and FROM tells it which table to read.

You can list columns by name, use * for all of them, calculate new columns with maths, and rename any column with AS.

Examples

1. Choose specific columns

SELECT name, price
FROM products;

Returns two columns, name and price, for every row in products.

2. Calculate and rename

SELECT name, price * 1.18 AS price_with_tax
FROM products;

Adds a calculated column. AS gives it a readable name.

Practice SELECT

4 questions, easiest first. Your progress is saved on this device.

  • โ—‹Your first queryeasy
  • ๐Ÿ”’Pick your columnseasy
  • ๐Ÿ”’Calculate a columneasy
  • ๐Ÿ”’No duplicateseasy
Practice SELECT