- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
SQL ORDER BY & LIMIT Quiz
This SQL quiz covers ORDER BY and LIMIT, the clauses behind every "top 5" or "cheapest first" list. You will predict sorted results, break ties with a second column and page through rows with OFFSET.
Sample question
Question 1 of 10What does this query return?
CREATE TABLE products (name TEXT, price INTEGER);
INSERT INTO products VALUES ('Pen', 2), ('Book', 12), ('Mug', 8), ('Lamp', 25), ('Cup', 8);
SELECT name FROM products ORDER BY price LIMIT 1;
Show the answer
B. Pen ORDER BY price sorts from lowest to highest, and LIMIT 1 keeps only the first row, the cheapest product.
What this quiz covers
- Sorting with
ORDER BY,ASCandDESC - Breaking ties with a second sort column
- Keeping the first rows with
LIMITand skipping rows withOFFSET - Sorting by a column alias or position
- Why
LIMITwithoutORDER BYgives no guaranteed rows
Questions people ask
Do I need an account?
No. Anyone can play. Sign in to keep your XP, streak, badges and history.
Can I retake it?
Yes. Your best score is kept, and the questions and answers are shuffled each time.