Reading data
- SQL course
- Beginner
- Lesson 20/115
- 5 min
Write the query to list records with SELECT.
Reading data
With the table in place we can read data. We list records from the notes table with SELECT.
SELECT id, title FROM notes;This returns the id and title of all notes.
id, title is selected from notes.
Reading data — details
Read is the R in CRUD. With SELECT you choose columns and rows. Here we list all notes; later we will fetch a single note.
Practice Reading data
Select id and title from the notes table.
Starter code
-- list notes
SELECT
FROMSample solution
SELECT id, title
FROM notesExpected output
id title 1 Alışveriş 2 Toplantı
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 All notes
SELECT id, title ____ notes;
SELECT id, title FROM notes;
Explanation: After the columns, FROM says which table to read from.
2 What does the R in CRUD stand for?
- Run
- Repeat
- Random
- Read Correct answer
Explanation: R stands for Read.
3 Reading data: match the terms
| Term | Meaning |
|---|---|
SELECT |
choose columns |
FROM |
table |
WHERE |
filter |
ORDER BY |
sort |