SQL Quest › SQL Interview Questions › Date Functions
2025 Sales
Show all DEED documents recorded in 2025 in our sales sample. document_date is text in YYYY-MM-DD format. Return document_id, document_date, document_amt for top 15 by document_amt descending (break ties by document_id ascending).
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
sales
| document_id | record_type | doc_type | recorded_borough | document_date | document_amt | recorded_datetime |
|---|---|---|---|---|---|---|
| 2025081800333001 | A | DEED | 1 | 2025-08-14 | 1080000000 | 2025-08-18 |
| 2024012300948001 | A | DEED | 1 | 2024-01-22 | 963000000 | 2024-01-24 |
| 2025081800439001 | A | DEED | 1 | 2025-08-14 | 810000000 | 2025-08-20 |
Expected output: Largest 2025 deals
Hint
WHERE doc_type = 'DEED' AND document_date LIKE '2025-%' (or use SUBSTR).
Concepts
SELECT WHERE Date Functions ORDER BY
Practise the topic: SQL practice questions · Date function practice
Related questions
Monthly Order CountEasy · FreeJanuary 2024 OrdersEasy · FreePre-1900 BanksEasy · FreeSpend by Day of WeekEasy · FreeThe Ledger's First Week, Day by DayEasy · FreeEmployee Tenure BandsMedium · Free
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test