Choosing Columns

SELECT chooses columns. FROM chooses the table.

SELECT * takes every column, which is convenient while exploring and a bad habit in real queries: it fetches data you do not need, and it silently changes meaning the day someone adds a column.

Try it

Add copies to the list. Then try selecting a column that does not exist, and read the error: SQLite tells you exactly which name it could not resolve.

loading editor…
real SQLite, in your browser

Two columns instead of five. Naming them is what you want in anything you keep.

Aliases rename a column in the output. SELECT title AS name returns a column called name. That matters for readability, and it matters more once you have expressions: SELECT copies * 2 AS doubled needs a name or the column is called whatever the database decides.

Mark this lesson complete

Signed in, your progress follows you to every device.

Next: Choosing Rows →
← Back