Practice Database MCQ questions with detailed answers and step-by-step explanations. 57+ free questions available with instant solutions — perfect for competitive exam preparation.
For a multi-million row analytics database, which data type is most storage-efficient for storing yes/no values?
AVARCHAR(5)
BCHAR(1)
CBOOLEAN/BIT
DINT
Correct Answer:
C. BOOLEAN/BIT
EXPLANATION
BOOLEAN/BIT uses minimal storage (1 byte or bit). CHAR(1) uses 1 byte. VARCHAR(5) uses more. INT uses 4 bytes. For large datasets, storage matters significantly.
In a manufacturing database, to find products with sales in ALL regions, which approach is correct?
ASELECT product_id FROM sales GROUP BY product_id HAVING COUNT(DISTINCT region) = (SELECT COUNT(*) FROM regions)
BSELECT product_id FROM sales WHERE region IN (SELECT DISTINCT region FROM sales)
CSELECT DISTINCT product_id FROM sales s1 WHERE region = 'North' AND EXISTS (SELECT 1 FROM sales WHERE product_id = s1.product_id)
DSELECT product_id FROM sales WHERE region = 'North' OR region = 'South'
Correct Answer:
A. SELECT product_id FROM sales GROUP BY product_id HAVING COUNT(DISTINCT region) = (SELECT COUNT(*) FROM regions)
EXPLANATION
Counts distinct regions per product and compares to total regions. Option B doesn't ensure ALL regions. Option C only checks one region. Option D is incomplete.
For optimizing a complex query joining 5 tables with WHERE conditions, what is the recommended approach?
AAlways use INNER JOINs first, then add WHERE conditions
BUse indexes on join columns and filter columns, check execution plan, simplify subqueries
CRewrite as multiple simple queries and combine in application
DUse VIEW instead of direct query
Correct Answer:
B. Use indexes on join columns and filter columns, check execution plan, simplify subqueries
EXPLANATION
Proper indexing on join and filter columns is crucial. Analyzing execution plan identifies bottlenecks. Application-level combining is inefficient. VIEWs don't inherently optimize.
Which anomaly in unnormalized database allows insertion of duplicate partial information without main entity?
AUpdate anomaly
BInsertion anomaly
CDeletion anomaly
DReferential anomaly
Correct Answer:
B. Insertion anomaly
EXPLANATION
Insertion anomaly occurs when you cannot insert data without complete information. Update anomaly = data inconsistency on updates. Deletion anomaly = loss of data when deleting.
In a bank database with accounts table, which query correctly identifies dormant accounts (no transactions in 2 years)?
ASELECT * FROM accounts WHERE last_transaction_date > DATE_SUB(NOW(), INTERVAL 2 YEAR)
BSELECT * FROM accounts WHERE last_transaction_date < DATE_SUB(NOW(), INTERVAL 2 YEAR)
CSELECT * FROM accounts WHERE last_transaction_date = DATE_SUB(NOW(), INTERVAL 2 YEAR)
DSELECT * FROM accounts WHERE DATEDIFF(NOW(), last_transaction_date) = 730
Correct Answer:
B. SELECT * FROM accounts WHERE last_transaction_date < DATE_SUB(NOW(), INTERVAL 2 YEAR)
EXPLANATION
Dormant accounts have last_transaction_date LESS THAN 2 years ago (older). Option A finds active accounts. Option D is too strict with exact day matching.
Which of the following is a valid correlated subquery for finding employees earning more than their department average?
ASELECT * FROM emp e WHERE salary > (SELECT AVG(salary) FROM emp)
BSELECT * FROM emp e WHERE salary > (SELECT AVG(salary) FROM emp e2 WHERE e2.dept_id = e.dept_id)
CSELECT * FROM emp WHERE salary > ALL (SELECT AVG(salary) FROM emp GROUP BY dept_id)
DBoth B and C
Correct Answer:
D. Both B and C
EXPLANATION
Both B and C are valid. B is a correlated subquery (references outer query). C uses ALL operator with aggregated subquery. A is incorrect as it compares to global average.
iGET offers 57+ free Database MCQ questions covering all important topics. Each question is prepared by subject experts and comes with detailed explanations to help you understand concepts deeply, not just memorize answers.
Why prepare with iGET?
100% free access, timed mock tests, instant results with detailed analysis, topic-wise progress tracking, and bookmark feature for revision. Trusted by thousands of aspirants preparing for UPSC, SSC, Bank, Railway, NEET, JEE and other competitive exams across India.
How to use this page effectively
Start by selecting a difficulty level (Easy / Medium / Hard) or pick a specific topic from the topics strip. Attempt questions, check your answer instantly, read the explanation carefully, and bookmark tricky ones for later revision. For full exam-style practice, take a Mock Test from the right sidebar.
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.
Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
iGET uses cookies for essential site functionality, analytics, and ads personalization (via Google AdSense). By clicking "Accept", you consent to our use of cookies.
Privacy Policy ·
Disclaimer