What is SQL? Your first SELECT

What a database, table, and query are.

1. What is this?

A database stores organised data. A table is a spreadsheet-like grid: rows are records (one user each), columns are fields (name, age). SQL (Structured Query Language) asks questions. SELECT name FROM users means 'show the name column from the users table'. * means all columns.

2. Why do we use it?

Every app with accounts, orders, or posts keeps them in a database. Reading with SELECT is the most-used skill.

3. Syntax breakdown

  • SELECT name FROM users;

    SELECT picks columns. FROM picks the table. Semicolon ends the statement.

  • SELECT * FROM users;

    * means all columns.

  • -- a comment

    Two dashes start a comment, ignored by the engine.

5. Common mistakes

  • Forgetting the semicolon — most engines require it between statements.
  • Misspelling a column or table name (names are case-sensitive in some systems).
  • SELECT * in production code — list the columns you actually need.

Practice task

Select only the name column from users.

Hint

Replace * with name.

Try it below — tests run automatically when you press Run.

sql

Output

Press Run to see output.

Mini quiz

3 questions. Answer, then check.

  1. 1. What is a table?

  2. 2. What does SELECT * mean?

  3. 3. What does FROM pick?

4. Example — edit and run

sql

Output

Press Run to see output.

Expected output: name | age ...