SQL QuestSQL Interview Questions › Joins

Your First JOIN

EasyFreeQuerying BasicsJoins

Combine data from two tables! JOIN the orders and customers tables to show: customer name, membership, product, total, and order_date. Sort by order_date descending. Limit to 15 rows. JOINs let you connect related tables using a shared key.

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

orders

order_idcustomer_idproductcategoryquantitypricetotalorder_datecountrystatus
11Laptop ProElectronics11299.991299.992024-01-15USAcompleted
22Wireless MouseElectronics249.9999.982024-01-16Canadacompleted
33Office ChairFurniture1349.99349.992024-01-17USAcompleted

customers

customer_idnameemailsignup_datemembershiptotal_orders
1John Smithjohn.smith@email.com2023-01-15Gold15
2Emma Wilsonemma.wilson@email.com2023-03-20Silver8
3Michael Brownmichael.brown@email.com2023-02-10Gold12

Expected output: Orders enriched with customer name and membership

Hint

FROM orders o JOIN customers c ON o.customer_id = c.customer_id links the tables. Use aliases (o, c) to keep it readable.

Concepts

SELECT JOIN

Practise the topic: SQL practice questions · JOIN practice

In these company practice sets

Walmart · Microsoft

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

JOIN with a FilterEasy · FreeLEFT JOIN: Watch the NULLs AppearEasy · FreeCounting Across a JOINEasy · FreeTransaction Share by Merchant CategoryEasy · FreeSignup-Month Cohort SpendEasy · FreeCard Spend by CountryEasy · 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