Tables and Select
Select Columns
Reading Only What You Need
SELECT can return a subset of columns. This keeps query results focused.
Program
Play the script to load books, then select only title and price.
select_columns.sql
CREATE TABLE books (id INTEGER, title TEXT, price INTEGER);
INSERT INTO books VALUES (1, 'SQL', 30);
INSERT INTO books VALUES (2, 'R', 25);
SELECT title, price FROM books ORDER BY id;
projection
Selecting columns is called projection.
ORDER BY
`ORDER BY id` makes row order deterministic.
result set
A query returns a table-shaped result.