#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🗄️ FREE · RUNS SQLITE IN BROWSER

SQL Practice Questions: Write Queries and Get Them Checked

Sixteen real-world questions on a small company database, checked in your browser.

  • ✅ Auto answer checking
  • 🔗 Joins, GROUP BY, HAVING
  • 🧩 Subqueries and self joins

How to use the SQL Practice Questions

  1. 1. Pick a questionChoose a question and open the table list to see the columns.
  2. 2. Write your SQLType a query and press Run only to test it, or Check answer.
  3. 3. Compare resultsThe checker compares your rows with a model answer and tells you what differs.

The practice database

Three small tables are loaded fresh each time you run a query: departments (4 rows), employees (10 rows with salary, hire date, city and manager) and orders (8 sales). Because the data is small, you can check results by eye while you learn.

Questions build from simple SELECT and WHERE to GROUP BY with HAVING, INNER and LEFT JOIN, self joins and subqueries. One example: the second highest salary. The model query is SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees); and the answer in this data is 88000, because the top salary is 95000.

How answer checking works

The checker runs your query and a model answer on the same data, then compares the result rows. Column names and aliases do not matter, so COUNT(*) AS total and COUNT(*) both pass. Row order is ignored unless the question says order matters. Decimal results are compared to six places, so AVG works however you round it.

The SQL engine is SQLite compiled to WebAssembly (the open-source sql.js library, version 1.10.3, loaded from cdnjs). It runs entirely in your browser; your queries are never sent to a server. SQLite syntax is close to MySQL and PostgreSQL for these questions, but a few functions differ, such as using || to join text.

Ready for more? Try the window functions playground or build queries with the SQL query builder.

Frequently asked questions

Can I break the database?

No. Every run starts from a fresh copy of the sample data, so DELETE or DROP statements only affect that one run.

Why does my correct query fail?

Check that you return the same columns as the question asks, and that you included or excluded NULL rows as described. The message tells you if the row or column count differs.

Is the SQL Practice Questions free?

Yes, the SQL Practice Questions is free. The first time you run or check your first query, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.

More free tools

See all free tools