How to select data

Start with SELECT

SELECT describes the values to return, and FROM identifies the source table.

SELECT *
FROM courses;

Understand the result

The asterisk requests every column. Unless another clause limits it, the query returns every row visible to your database user.

Format for readability

SQL keywords are case-insensitive in SQLite, PostgreSQL, and MySQL. Uppercase keywords and separate clauses make queries easier to scan.

SELECT *
FROM students
WHERE enrolled = 1;

Do not assume order

A table has no guaranteed display order. Add ORDER BY whenever the order matters.