SQL Quest › SQL Interview Questions › Joins
Property Sale + Buyer
For Manhattan DEED documents above $5M: show bbl, address (from properties), document_amt, buyer_name. Triple JOIN: sales → sales_legals → properties, plus sales → sales_parties (filtered to BUYER). Order by document_amt descending. Top 10.
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 |
sales_legals
| document_id | bbl | property_type | street_number | street_name | unit |
|---|---|---|---|---|---|
| 2026030200174005 | 2059330225 | CR | 5921 | PALISADE AVENUE | NULL |
| 2026031100344013 | 3024141401 | OT | 280 | KENT AVENUE | NRU |
| 2026030200423005 | 3043930001 | AP | 180 | WORTMAN AVENUE | NULL |
properties
| bbl | borough | address | zip | bldg_class | land_use | year_built | num_floors | units_residential | units_total | lot_area_sqft | bldg_area_sqft | assess_total | owner_name | latitude | longitude |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1009720001 | MN | 240 1 AVENUE | 10009 | D7 | 4 | 1945 | 13.0000000 | 8764 | 8812 | 2675000 | 8942176 | 790924050.00000 | BPP ST OWNER LLC | 40.7317236 | -73.9778964 |
| 1009950005 | MN | 1472 BROADWAY | 10036 | O4 | 5 | 1998 | 51.0000000 | 0 | 2 | 45800 | 1642675 | 489648150.00000 | NYC ECONOMIC DEVELOPMENT CORPORATION | 40.7560214 | -73.9857642 |
| 1010070029 | MN | 1345 AVENUE OF THE AMER | 10105 | O9 | 5 | 1968 | 49.0000000 | 0 | 50 | 90375 | 1931978 | 429758550.00000 | 1345 LEASEHOLD LLC | 40.7630634 | -73.9792541 |
sales_parties
| document_id | party_type | party_role | name |
|---|---|---|---|
| 2026030200174005 | 1 | SELLER | RIVER'S EDGE |
| 2026030200423005 | 1 | SELLER | STANLEY AVENUE PRESERVATION HDFC |
| 2026030200423005 | 2 | BUYER | NEW YORK CITY HOUSING DEVELOPMENT CORPORATION |
Expected output: Building + price + who bought it
Hint
Concepts
SELECT JOIN WHERE Multi-JOIN
Practise the topic: SQL practice questions · JOIN practice
Related questions
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