SQL (Structured Query Language) is how you ask a database questions. Almost every company stores its data in databases, so SQL is the most widely requested skill in data analyst job descriptions. The good news: it is one of the easiest technical skills to start with.
Databases and tables in one minute
A database holds many tables. A table looks like a spreadsheet: columns describe what is stored (name, city, amount) and each row is one record (one customer, one order).
We will use a students table for a fictional coaching institute, BrightPath Academy:
| student_id | name | city | course | fee_paid | joined_on |
|---|---|---|---|---|---|
| 1 | Neha | Jaipur | SQL | 4000 | 2026-06-02 |
| 2 | Arjun | Lucknow | Python | 5000 | 2026-06-10 |
| 3 | Sana | Jaipur | Power BI | 3500 | 2026-07-01 |
Your first ten queries
1. See everything
SELECT * FROM students;* means all columns. Fine for a quick look; in real work, name the columns you need.
2. Pick columns
SELECT name, city FROM students;3. Filter rows
SELECT name, course FROM students WHERE city = 'Jaipur';Text values go in single quotes.
4. Combine conditions
SELECT name FROM students WHERE city = 'Jaipur' AND fee_paid >= 4000;5. Match a list
SELECT name FROM students WHERE course IN ('SQL', 'Python');6. Match a pattern
SELECT name FROM students WHERE name LIKE 'S%';% matches any number of characters: this finds names starting with S.
7. Sort
SELECT name, fee_paid FROM students ORDER BY fee_paid DESC;8. Take the top rows
SELECT name, fee_paid FROM students ORDER BY fee_paid DESC LIMIT 2;9. Count and total
SELECT COUNT(*) AS students, SUM(fee_paid) AS total_fees FROM students;10. Group
SELECT course, COUNT(*) AS students, AVG(fee_paid) AS avg_fee
FROM students
GROUP BY course;This one query already answers a real business question: how many students each course has and what they pay on average.
Habits worth building from day one
- Write keywords in capitals and put each clause on its own line; it is easier to read and debug.
- Use clear aliases with
AS. - Check row counts: does the result have as many rows as you expect?
- Read the error message; it usually tells you exactly which word is wrong.
What to learn next
After these basics, learn WHERE vs GROUP BY vs HAVING, then joins. The best way to learn is to type queries yourself: our SELECT and WHERE practice runs SQL right in your browser and checks your answer instantly.
Practise what you just read
Reading helps; writing the code yourself is what sticks. Start here: