SELECT Statement
Fetch data from a database table
✅ What You Will Learn
The SELECT statement is the most used command in SQL. Every query that retrieves data starts with SELECT. You use it to choose which columns to display from a table.
When you write a SELECT query, you are telling the database: "Give me these specific columns from this specific table." The database returns a result set — a temporary table of matching rows that only exists while you are viewing it.
SELECT does not change or delete any data. It only reads. This makes it completely safe to run on any database.
📋 The orders table used in examples
| order_id | customer_name | product | amount | city | order_date |
|---|---|---|---|---|---|
| 1001 | Rahul Sharma | Laptop | 45000 | Delhi | 2026-01-15 |
| 1002 | Priya Verma | Mobile Phone | 18000 | Noida | 2026-01-16 |
| 1003 | Amit Kumar | Headphones | 3500 | Gurgaon | 2026-01-16 |
| 1004 | Sneha Kapoor | Laptop | 52000 | Delhi | 2026-01-17 |
| 1005 | Vikram Singh | Tablet | 28000 | Noida | 2026-01-18 |
Syntax
Examples
📌 Key Points to Remember
- ✓SELECT fetches data — it never modifies the original table
- ✓List column names separated by commas after SELECT
- ✓Use * to get all columns (for exploration only)
- ✓AS creates an alias — a temporary name for a column in the result
- ✓SELECT DISTINCT removes duplicate rows from the result
🏢 Real-World Application
Every dashboard you see at a company is powered by SELECT queries. A sales report in Power BI pulls data using SELECT customer_name, SUM(revenue) from a sales table. A finance team member checking daily transactions runs SELECT * FROM transactions WHERE date = TODAY(). When a product manager asks "how many users signed up this week?", a data analyst writes a SELECT query with COUNT() to answer it instantly. SELECT is the foundation of every SQL query you will ever write — mastering it means you can start answering business questions immediately.
⚠️ Common Mistakes to Avoid
❓ Frequently Asked Questions
What does SELECT * do in SQL?
SELECT * retrieves all columns from a table. It is useful for quick exploration but should be avoided in production queries because it fetches unnecessary data, slows performance on large tables, and can break code if columns are added or removed.
Can you use SELECT without FROM?
Yes — in many databases you can run SELECT 1+1 or SELECT GETDATE() without a FROM clause to calculate expressions or get system values. But for table data, FROM is always required.
What is the difference between SELECT and SELECT DISTINCT?
SELECT returns all rows, including duplicates. SELECT DISTINCT removes duplicate rows and returns only unique combinations of values for the selected columns.
How do you rename a column in SQL SELECT?
Use the AS keyword: SELECT amount * 0.18 AS gst_amount. The alias only exists in the result set — it does not change the actual column name in the database table.
Is SELECT case-sensitive in SQL?
The SELECT keyword itself is not case-sensitive — SELECT, select, and Select all work. But string data comparisons (like WHERE city = 'Delhi') may be case-sensitive depending on the database and its collation settings.
✏️ Practice Exercise
Write a query to select only the customer_name and order_date from the orders table.
Learn SQL with Live Trainer Guidance
These tutorials give you the theory. Our live SQL course at EVIKA Academy, Noida teaches you to apply SQL on real company datasets — with a trainer who uses it daily at MakeMyTrip.