Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Order Details Across Three Tables

Medium Joins

For every order return the order id, the customer's name, the product name and the product price. Order by order id.

Table schema

Customers(id INT PRIMARY KEY, name VARCHAR(50))
Products(id INT PRIMARY KEY, name VARCHAR(50), price INT)
Orders(id INT PRIMARY KEY, customer_id INT, product_id INT)

Sample data

Customers:
id | name
1 | Aman
2 | Riya

Products:
id | name | price
1 | Pen | 10
2 | Book | 50

Orders:
id | customer_id | product_id
1 | 1 | 2
2 | 2 | 1
3 | 1 | 1

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.