🔍 Data Query Language (DQL)
Last Updated: 7th January 2026
Data Query Language (DQL) is a part of SQL used only to retrieve data from a database. It does not modify the data — it only queries (asks) the database.
- DQL is mainly based on the SELECT command
- It is used to:
- fetch data
- filter data
- sort data
- group data
Hinglish Tip 🗣: DQL ka kaam sirf data dekhna aur nikalna hota hai, data change karna nahi.
🧾 Core DQL Command
SELECT
SELECT * FROM students;
- This query fetches all columns
- From the students table
⚠️ SELECT is the only command in pure DQL.
Clauses Used with DQL
DQL becomes powerful when combined with SQL clauses.
Note: We Wil Cover Each Clause In Upcoming Tutorials
🔢 Clause Order Matters (Very Important)
SQL clauses must follow a fixed logical order. Changing the order can cause errors or wrong results.
Example Showing Clause Order
SELECT department, AVG(salary)
FROM employees
WHERE salary > 30000
GROUP BY department
HAVING AVG(salary) > 40000
ORDER BY AVG(salary) DESC
LIMIT 5;
👉 Focus here is order, not logic. Each clause appears in its correct position.
