SQL: Find the Bug

This SQL quiz shows queries with a comment saying what they were meant to do, and asks what they really return or what is wrong. The bugs are the ones that slip into real code and interviews, like operator precedence, join fan-out, integer division and subqueries that quietly match everything.

कठिन 10 सवाल ~8 मिनट पास होने के लिए 80% SQLite

मोड चुनें

आप गेस्ट के तौर पर खेल रहे हैं: XP और streak सेव रखने के लिए साइन इन करें।

सैंपल सवाल

सवाल 1 / 10

The query below has a bug. What does it print?

CREATE TABLE products (name TEXT, category TEXT, price INTEGER);
INSERT INTO products VALUES
  ('pen', 'office', 2), ('desk', 'office', 300),
  ('tv', 'tech', 500), ('cable', 'tech', 5);
-- meant: cheap items (price < 10) in office or tech
SELECT COUNT(*) FROM products
WHERE category = 'office' OR category = 'tech' AND price < 10;
जवाब दिखाएं

B. 3 AND binds tighter than OR, so this means office OR (tech AND price < 10): pen, desk and cable. Add parentheses, (category = 'office' OR category = 'tech') AND price < 10, or use category IN ('office', 'tech'), to get the intended 2.

इस क्विज़ में क्या है

  • AND/OR precedence and date range edges
  • COUNT(*) with LEFT JOIN, and join fan-out in SUM
  • Integer division in percentages
  • Ambiguous columns, UNION mismatches and quoting
  • Subqueries and window functions used in the wrong place

अक्सर पूछे जाने वाले सवाल

क्या अकाउंट ज़रूरी है?

नहीं। कोई भी खेल सकता है। XP, streak, badge और हिस्ट्री सेव रखने के लिए साइन इन करें।

क्या मैं इसे दोबारा दे सकता हूं?

हां। आपका बेस्ट स्कोर सेव रहता है, और हर बार सवाल और जवाब शफ़ल होते हैं।