Your first query
A database stores data in tables. A table is like a spreadsheet: each row is one thing (a product, a customer) and each column is one fact about it (name, price).
This lesson's practice shop has a products table:
| id | name | category | price |
|---|---|---|---|
| 1 | Laptop | Electronics | 650.00 |
| 2 | Phone | Electronics | 220.00 |
| 3 | Headphones | Electronics | 45.00 |
| ... |
You get data out with SQL (Structured Query Language), using a SELECT statement:
SELECT * FROM products;
SELECTsays which columns you want.*means "all of them".FROMsays which table to read.- The semicolon ends the statement.
Usually you only want some columns. List them, separated by commas:
SELECT name, category FROM products;
SQL keywords are not case-sensitive (select works too), but writing them in capitals makes queries easier to read.
The database runs in your browser (SQLite). Press Run ▶ to see the result table.
Your task
Write a query that shows the name and price of every product.