How to Use SELECT in SQL
Use SELECT when you need to read data from a table without changing it. This is the most common SQL statement for exploring rows, filtering records, and building reports.
What you’ll build or solve
You’ll learn how to use SELECT in SQL to read specific columns, all columns, and filtered results. You’ll also know how to keep queries readable and efficient.
Learn SQL on Mimo
When this approach works best
This approach is the right choice when you need to retrieve data instead of modifying it.
Common real-world scenarios include:
- Viewing user records
- Building dashboards
- Checking order history
- Reporting sales
- Verifying inserted data
This is a bad idea when the goal is to change data. In that case, use UPDATE, INSERT, or DELETE.
Prerequisites
You only need:
- A SQL database with at least one table
- Basic table and column knowledge
Step-by-step instructions
Step 1: Select the columns you need
Start with the SELECT keyword, then list the columns.
SQL
SELECT first_name, email
FROM users;
This returns only the chosen columns.
Use * when you need every column.
SQL
SELECT *
FROM users;
Add a WHERE clause to filter rows.
SQL
SELECT order_id, total
FROM orders
WHERE status = 'paid';
What to look for:
SELECTreads data only- List only needed columns when possible
*returns every columnWHEREfilters matching rows- Cleaner column selection improves performance
Examples you can copy
View one user
SQL
SELECT *
FROM users
WHERE user_id = 42;
Paid orders
SQL
SELECT order_id, total
FROM orders
WHERE status = 'paid';
Product list
SQL
SELECT name, price
FROM products;
Common mistakes and how to fix them
Mistake 1: Overusing SELECT *
What the reader might do:
SQL
SELECT *
FROM orders;
Why it breaks: unnecessary columns make large queries slower and harder to read.
Corrected approach:
SQL
SELECT order_id, total
FROM orders;
Mistake 2: Forgetting quotes for string filters
What the reader might do:
SQL
WHERE status = paid
Why it breaks: SQL treats paid like a column name.
Corrected approach:
SQL
WHERE status = 'paid'
Mistake 3: Missing the table name
What the reader might do:
SQL
SELECT email;
Why it breaks: SQL does not know where the column comes from.
Corrected approach:
SQL
SELECT email
FROM users;
Troubleshooting
If the query returns too much data, replace * with exact columns.
If no rows match, verify the WHERE filter value.
If string filters error, add single quotes.
If the column name is ambiguous, include the table alias or table name.
Quick recap
- Use
SELECTto read data - List only needed columns
- Use
*only when necessary - Add
WHEREto filter rows - Quote string values with single quotes
Join 35M+ people learning for free on Mimo
4.8 out of 5 across 1M+ reviews
Check us out on Apple AppStore, Google Play Store, and Trustpilot