Selecting Columns and Expressions
Project columns, compute derived expressions, alias results with AS, and use DISTINCT to remove duplicates.
The Basic SELECT
SELECT projects columns from one or more tables.
SELECT id, email, full_name
FROM users;SELECT *
SELECT * returns every column. Convenient in the REPL, bad in production code:
- Returns more bytes than you need
- Breaks when columns are added or reordered
- Hides intent in code review
All lessons in this course
- Selecting Columns and Expressions
- WHERE Filters: Comparison and Logic Operators
- ORDER BY Single and Multiple Columns
- LIMIT, OFFSET and Pagination Basics