SQL FROM
Say which table (or tables, or subquery) the rows come from.
Syntax
SELECT … FROM table [AS alias];
FROM is the first clause the database actually runs. It can name a table, a view, a subquery (with an alias) or several tables joined together.
Example
Query (on the shop database used in the SQL course)
SELECT c.name, c.country FROM customers AS c LIMIT 5;
Result
| name | country |
|---|---|
| Aarav Sharma | New Zealand |
| Mia Chen | Australia |
| Liam Walker | Australia |
| Sita Gurung | Australia |
| Noah Brown | Australia |
5 rows
Related
Learn it step by step in the free lesson SELECT: Choosing Columns, with exercises that check your queries.