Your First SQL SELECT Statement
A SELECT query chooses columns from a table and returns a result.
The first SQL pattern to learn is SELECT plus FROM. SELECT says which columns you want, and FROM says which table to read.
LIMIT is useful while learning because it keeps the result small.
select column_one, column_two
from table_name
limit 5When to use SELECT
Use SELECT when you want to inspect data without changing it. A good first query asks for a few named columns from one table, then limits the result so you can check the shape before adding filters, joins, or calculations.
Avoid starting every query with select *. It is useful for quick exploration, but named columns make the result easier to read and keep later reports from breaking when a table changes.
Schema · Garden ShopTable · products9 columns · 24 rows
One row per product, with price, cost, and inventory levels.
Show each product's product name and price. Keep the result to the first 5 rows.
- Columns: product_name, price.
- Rows: 5 products.
Related
Understand tables, rows, columns, and queries.
Learn the basic shape of relational data.
Run queries and read results in the browser.
Scout table sizes before writing larger reports.