SQL Coding Practice: 320+ Exercises and Interview Challenges

Write queries from SELECT to JOINs, subqueries, CTEs and window functions across 20 industry case studies

  • 0.0 (0 Reviews)
  • 0 Students
  • 331 Lessons
  • Soundhar K

Course Overview

Reading SQL and writing SQL are different skills. You can follow every step of a tutorial, nod along to a JOIN explanation, and still sit in front of an empty editor in a placement test with no idea where to start. The only fix is writing queries, a lot of them, and finding out straight away whether each one is right.

That's the whole design of this course. It has 321 coding exercises, organized into 13 levels, and you write every query yourself in the editor built into the course. Each exercise checks your output when you run it. Wrong rows, a missing column or a sort in the wrong direction shows up immediately, so you fix it and run it again. Five short lectures at the start cover how to think before you write a query, the mistakes almost everyone makes, and how to use the course for interview preparation. After that, it's practice.

How the levels build

The first three levels are about getting comfortable. Level 1 has 50 exercises on SELECT, column aliases, DISTINCT and LIMIT, built around a product catalog for an electronics retailer, plus customer, supplier and employee directories. Filtering comes next in Level 2: price ranges, brand lists, LIKE patterns such as names that start with Galaxy or contain Air, and finding customers with no email or phone number. It ends with filtering problems from banking, hospitals, airlines, shipping and hotels, so the same WHERE logic shows up on unfamiliar tables. Sorting and single-row functions fill Level 3: cleaning imported supplier names, building employee initials, stripping hyphens from phone numbers, rounding a loan EMI and working out how many delivery trucks an order needs.

Levels 4 to 6 move into reporting. You'll write aggregate queries for KPI summaries, then GROUP BY by department, region and category, then HAVING clauses that stack conditions, such as departments with more than two people and an average above a threshold, or suppliers above a purchase total or with more than two orders. These are the queries behind most weekly business reports, and they're where a lot of people quietly get wrong answers. A WHERE clause that should have been a HAVING, or an average taken before a filter instead of after, still returns a tidy-looking table. Learning to spot that is half the point of these levels.

Levels 7 and 8 are joins. You start by joining employees to departments, then add projects, then clients, until you're writing four-table reports on client billing and resource allocation. Level 8 is the one interviewers love: LEFT JOIN, RIGHT JOIN and SELF JOIN problems that find what's missing. Employees with no project. Departments with no staff. An employee-to-manager hierarchy. It finishes with a data integrity audit that checks for records pointing at departments and clients that don't exist.

Levels 9 to 11 are the advanced tools. Subqueries come first, including correlated subqueries, EXISTS and NOT EXISTS, and harder questions such as customers who bought every product in a category. CTEs come next, from a single CTE to chained and layered ones that classify employees into bands and build a promotion eligibility report. Window functions close the run: ROW_NUMBER, RANK and DENSE_RANK, NTILE quartiles, LAG and LEAD comparisons, FIRST_VALUE and LAST_VALUE, running totals and moving averages.

Case studies and interview challenges

Level 12 is 20 business case studies, each in a different industry: retail, banking, hospitals, airlines, hotels, logistics, insurance, telecom, restaurants, pharmacies, cinemas, gyms, car rental, public transport and more. Each one asks you to build the numbers for a performance dashboard, which means choosing the right mix of joins, grouping and window functions yourself rather than being told which topic you're on.

Level 13 is 24 SQL interview challenges, the ones that keep coming up in technical rounds: second and Nth highest value, top three per department, customers who never ordered, duplicate emails, consecutive login days, a 7-day rolling average, gaps between order dates, missing invoice numbers, month-over-month growth, the median, a recursive reporting hierarchy and customer lifetime value. It ends with a capstone leaderboard challenge.

Mock interviews

The last section has five AI role plays: Junior SQL or Junior Data Analyst, Mid-Level Backend Developer (SQL heavy), Mid-Level Data Analyst, Senior Data Analyst or Analytics Engineer, and Senior SQL or Database Developer. You talk through problems with an AI interviewer, handle the follow-up questions and get feedback, as often as you want. Having both analyst and developer tracks matters, because a backend interview asks about SQL in a different way than an analytics interview does.

How to use it

Work through the levels in order if you're new to SQL. Already know the basics? Take the section challenge at the end of a level. If it's easy, move on, and if it isn't, go back into that level. Most levels end with one or more section challenges that combine what came before, so they're a quick check of where you really stand.

Who it's for, and who it isn't

This course suits students and freshers facing placement tests and online coding rounds, aspiring analysts who need to write reporting queries fast, and developers preparing for SQL-heavy interviews. It assumes nothing to start, but it's not a lecture course. If you want long video explanations of database theory, normalization or administration, this isn't the right fit. It's for people who learn by doing.

What you need is a browser. There's nothing to install and no database to set up.

Start with Level 1 or jump to the first section challenge, and let the results tell you where to go next.

See more

FAQ

FAQ area empty

Course curriculum

Requirment

  • A computer with a browser. Every exercise runs in the coding editor inside the course, so there is nothing to install.

  • No prior SQL is needed to begin. Level 1 starts at SELECT, and if you already know the basics you can jump to the level that challenges you.

Outcomes

  • Write SELECT, DISTINCT, ORDER BY and LIMIT queries that turn raw product, customer and order tables into clean, readable reports.

  • Filter with LIKE patterns, IN, BETWEEN and NULL checks to return exactly the rows a request describes, with nothing extra or missing.

  • Clean text and numbers with UPPER, TRIM, SUBSTR, REPLACE, ROUND, CEIL and MOD to prepare mailing labels, IDs and finance figures.

  • Summarize data with GROUP BY and HAVING, including filters that combine counts, totals and averages with AND, OR and BETWEEN.

  • Find missing and orphaned records with LEFT JOIN, SELF JOIN and NOT EXISTS, such as projects with no staff or employees with no manager.

  • Break hard problems into correlated subqueries, chained CTEs and a recursive CTE that walks an employee reporting hierarchy.

  • Rank, compare and roll up rows with ROW_NUMBER, DENSE_RANK, NTILE, LAG, LEAD, FIRST_VALUE, running totals and moving averages.

  • Solve classic SQL interview problems: Nth highest value, consecutive login days, missing invoice numbers, the median and customer lifetime value.

Instructor

...
Soundhar K

0.0

  • ... 0 Student
  • ... 1 Course
  • ... 0 review

View Details

Reviews

Rate this course :

Remove all