Programming

SQL SELECT: read data from a table

Read rows with SELECT, FROM and WHERE.

All lessons · SQL lessons: SELECT

SELECT: read from a table

SQL is the language for asking a table. SELECT says which columns, FROM says which table.

SELECT name, city
FROM users;

WHERE: a condition

WHERE keeps only the matching rows. This query brings the names of users in Baku.

SELECT name
FROM users
WHERE city = 'Baku';

Questions

What does SELECT pick? The columns you want to see from the table.

What is FROM for? It says which table holds the data.

What if there is no WHERE? Every row in the table comes back.

Why is the city name in quotes? A text condition is written in quotes. A number is not.

Author: Nibras Code