1918. Find gaps in dates — Marketplace — implementation variant 18

DBMS Published Updated 0 Views Verified
In a Marketplace application, implement this production problem: Find dates with no orders in a generated calendar range. The API/service receives user input and must return or modify data safely. Give the SQL solution, explain why it works, and show how the same operation is called from the selected stack.
Looking for the latest Sarkari Result 2026 updates? Check the latest government exam results, merit lists and result updates on Sarkari Resultess.
Sarkari Resultess
Questions & Answers

Answer & Explanation

4 Answers
Verified

Option A

SELECT * FROM the_table;
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 1
Verified

Option B

DELETE FROM the_table;
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 2
Verified

Option C

UPDATE the_table SET status='active';
Additional Explanation
Incorrect: it does not implement the stated business rule and may modify/fetch the wrong rows.
Sarkari Resultess
Editorial Answer 3
Verified Correct Answer

Option D

WITH RECURSIVE dates AS (SELECT CAST(:start_date AS DATE) d UNION ALL SELECT d+INTERVAL 1 DAY FROM dates WHERE d<:end_date) SELECT d FROM dates d LEFT JOIN orders o ON DATE(o.order_date)=d.d WHERE o.id IS NULL;
Additional Explanation
A calendar CTE provides dates even when the fact table has no row for that date.
Sarkari Resultess
Editorial Answer 4