Skip to main content
Intermediatehow it works Verified ~7 min

How do you find weekdays that have no rows in a daily trading table (missing dates) in SQL?

Source: PostgreSQL: SELECT (clause processing)

Quick answerFree

Generate every calendar date in the range (a calendar table, generate_series or a recursive CTE), keep Monday to Friday, then anti-join to the trades table with LEFT JOIN ... WHERE trade_date IS NULL or NOT EXISTS. Market holidays need a holiday table, otherwise they show as missing.

Detailed answer· ~260 words

Interview Prep

Unlock the full answer with Interview Prep

Get a ~260-word model answer, 5 key points, a visual explainer, 4 common mistakes and 4 follow-ups, plus 247 more SQL questions.

Also in Pro (₹499 / 90 days).

Key points· 5 points

Interview Prep
Unlock with Interview Prep

Visual explainer· animated, step by step

Interview Prep
Unlock with Interview Prep

Common mistakes· 4

Interview Prep
Locked

Best practices· 3

Interview Prep
Locked

Likely follow-ups· 4 questions

Interview Prep
Unlock with Interview Prep

+ 247 more SQL questions in Interview Prep, each with the full answer.

Discussion