SELECT Basics

Lesson 5 of 20

Ask a table for exactly the columns you want and watch the result grid fill, one projected row at a time.

The big picture

Two keywords, one grid

Almost every SQL story starts the same way: SELECT the columns, FROM the table. Everything else is decoration.

SELECT picks columns

List the columns you want, separated by commas, in the order you want them.

FROM picks the table

The engine scans that table and hands each row to SELECT for trimming.

The star shorthand

SELECT * means every column, in table order. Great for exploring, wasteful in production.

Rows keep their order

Without ORDER BY, rows come back in whatever order the scan found them.