Pull rows out, then filter them

INPUT · Slides

Your first SQL

01 / 05

What is SQL?

The data behind an app — users, products, posts — is kept in a database.

SQL is the language you use to talk to it. "Show me this", "add this", "get rid of this" — you say it in statements.

02 / 05

Data lives in tables

What is inside a database is shaped like a table.

This course uses a canteen's menus table.

  • Columnsid / name / price / category
  • Records (rows) … one dish each

03 / 05

Pulling data out with SELECT

SELECT column FROM table; gives you every row of that column.

You can read it as "from menus, select name". SQL sits close to an English sentence.

SELECT name FROM menus;

Result

curry rice / tofu udon / omelette rice / soy ramen / fried chicken set

04 / 05

Several columns at once

Line the column names up with , and you can take several at the same time.

SELECT name, price FROM menus;

05 / 05

* for every column

Use * (an asterisk) and you get every column.

Have a look at the whole thing with * first, then narrow to the columns you need — that is the first step of exploring a database.

SELECT * FROM menus;