CodeBlanks Logo Icon CodeBlanks

Reading data

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

query.sql
-- list notes
SELECT
FROM

Sample solution

query.sql
SELECT id, title
FROM notes

Expected 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

Question
SELECT id, title ____ notes;
Answer
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

All lessons in Beginner