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

Order City Lookup (Three-Table Join)

Return each order id with the customer name and the city name, ordered by order id.

Table schema

Orders(id INT PRIMARY KEY, customer_id INT)
Customers(id INT PRIMARY KEY, name VARCHAR(20), city_id INT)
Cities(id INT PRIMARY KEY, city VARCHAR(20))

Sample data

Orders
id | customer_id
1 | 1
2 | 2
3 | 1

Customers
id | name | city_id
1 | Ann | 10
2 | Bob | 20

Cities
id | city
10 | Pune
20 | Delhi

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.