SQL SELECT Statement
SELECT is how you read data in SQL. You list the columns you want after SELECT and name the table after FROM. Almost every query you write will start this way.
Updated December 1, 2026
Syntax
SELECT column1, column2
FROM table_name;
Select specific columns
List the columns you need, separated by commas. The result keeps them in the order you wrote them, whatever order they have in the table.
SELECT name, price
FROM drinks;
| name | price |
|---|---|
| Espresso | 3 |
| Latte | 4.5 |
| Cappuccino | 4.25 |
| Mocha | 5 |
| Cold Brew | 4.75 |
| Matcha Latte | 5.25 |
| Chai Latte | 4.75 |
| Peppermint Tea | 3.25 |
| Hot Chocolate | 4 |
| Lemonade | 3.5 |
Select every column with *
SELECT * returns every column. It’s handy for exploring a table you haven’t seen before. In real applications, list the columns instead, so your query doesn’t change when someone adds a column.
SELECT *
FROM customers;
| id | name | city | joined |
|---|---|---|---|
| 1 | Ava | Austin | 2024-01-15 |
| 2 | Ben | Seattle | 2024-02-03 |
| 3 | Cara | Denver | 2024-02-20 |
| 4 | Dev | Austin | 2024-03-11 |
| 5 | Eli | Seattle | 2024-04-08 |
| 6 | Fay | NULL | 2024-05-19 |
| 7 | Gus | Denver | 2024-06-01 |
| 8 | Hana | Austin | 2024-06-24 |
Calculate new values
A column in SELECT doesn’t have to exist in the table. You can do arithmetic and call functions, then name the result with AS. Here we add 10% tax and round to cents.
SELECT name, price, ROUND(price * 1.10, 2) AS price_with_tax
FROM drinks;
| name | price | price_with_tax |
|---|---|---|
| Espresso | 3 | 3.3 |
| Latte | 4.5 | 4.95 |
| Cappuccino | 4.25 | 4.68 |
| Mocha | 5 | 5.5 |
| Cold Brew | 4.75 | 5.23 |
Common mistakes
- Forgetting the comma between column names.
SELECT name pricereads as “name, renamed to price”. - Adding a comma after the last column:
SELECT name, price, FROM drinksis a syntax error. - Putting column names in single quotes.
'name'is the text “name”, not the column. - Using
SELECT *in application code, which pulls columns you don’t need and breaks when the table changes.
Practice SELECT Statement interactively
Write real queries in your browser and get instant feedback in the lesson “Your first SELECT” (Unit 1). It’s free.
Frequently asked questions
Is SQL case sensitive?
Keywords like SELECT and FROM are not. Writing them in capitals is just a convention. Whether text values like 'Latte' match case-sensitively depends on the database and its settings.
Do I need a semicolon at the end?
It marks the end of a statement. Many tools accept a single query without one, but it’s good practice, and it’s required when you run several statements together.
Can I SELECT without FROM?
In most databases, yes: SELECT 2 + 2; returns 4. Oracle needs FROM dual.