SQL chapters

Chapter 1 of 17

SQL and relational data

Try this in our SQLite Compiler →

The idea

SQL describes the data you want rather than a loop of instructions. A table contains rows with named columns; SELECT produces a result set. This course's runnable examples use SQLite. Other engines have dialect differences, so SQL Server variables and PostgreSQL function definitions should not be pasted into SQLite.

Worked example

SELECT 'Hello, World!' AS greeting;

What to check

The result has one column named greeting and one row containing Hello, World!. No table is required for this expression.

Practice task

Select two literal values with descriptive column aliases. Distinguish the alias from the stored value.

Check your understanding

Explain the result in your own words before changing the example. Change one thing at a time, compare the result with your prediction, and keep the version that demonstrates the concept clearly.

Try it yourself

Output
Run your project to see output here.
Ctrl/Cmd+Enter runs · Ctrl/Cmd+S downloads the project · Local auto-save is always on