SELECT Clause in SQL
Last Updated: 7th January 2026
The SELECT clause is used to choose which columns you want to retrieve from a table.
It is the starting point of every DQL query.
SELECTtells the database what data to return- It does not decide the table (that is handled by
FROM) - It works only for reading data
Hinglish Tip 🗣: >
SELECTka matlab hai — database se kya-kya data chahiye, ye batana.
🧾 Basic Syntax of SELECT
SELECT column_name;
⚠️ This syntax alone is incomplete. In real queries, it is always used with other clauses, but here we focus only on SELECT behavior.
📂 Selecting All Columns
To select all columns from a table, use * (asterisk).
SELECT *;
Meaning:
*→ all available columns
📄 Selecting Specific Columns
You can select only required columns by listing them.
SELECT name, marks;
Benefits:
- Less data transfer
- Better readability
- Faster queries
🔁 Column Order Matters in SELECT
The order of columns in SELECT decides the order of output, not the table structure.
SELECT marks, name;
Output columns will appear as:
- marks
- name
✏ Using Aliases in SELECT
Aliases are temporary names given to columns in the result.
SELECT name AS student_name, marks AS score;
Why aliases are used:
- Improve readability
- Useful in reports
- Helpful with calculations
🧮 SELECT with Expressions
SELECT can also perform calculations.
SELECT marks + 5;
Example use cases:
- Adding bonus marks
- Calculating tax
- Showing derived values
🔍 SELECT with DISTINCT
DISTINCT removes duplicate values from the result.
SELECT DISTINCT department;
✔ Returns only unique values