This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.
 

Given the following tables:
Customer table – each row specifies the customer number, name, and city of residence.

CREATE TABLE Customers   
(CustomerID int identity(1,1),   
 CustomerName varchar(25),   
 CityID  int)  
GO  

34-2

City table – this table contains the names of cities for the customer table.

CREATE TABLE Cities   
(CityID int identity(1,1),   
 CityName varchar(25))  
GO   

34-3

Would you like to read more?