Produce a list of the cities in the customer table where each city is listed onc
ID: 3586044 • Letter: P
Question
Produce a list of the cities in the customer table where each city is listed once and the list is sorted. Send the list to a table name List of Cities. Please help me write the correct SQL syntax for the above instructions regarding the below data.
CustomerID
First Name
Last Name
Address
City
Phone Number
C0001
Eileen
Faulkner
2732 Baker Blvd.
Toronto
(647) 334-5678
C0002
Scott
Wit
120 Hanover Sq.
Ottawa
(613) 358-3364
C0003
Benjamin
Grauer
1007 W. Main St
Toronto
(647) 998-4457
C0004
Wendy
Solomon
12 Orchestra Terrace
Kitchener
(519) 447-2283
C0005
Alex
Rey
P.O. Box 555
Toronto
(647) 988-3346
C0006
Ted
Myerson
2743 Bering St.
Ottawa
(613) 447-5565
C0007
Lori
Sangastiano
2743 Bering St.
Toronto
(647) 775-3389
C0008
Michelle
Zacco
89 Jefferson Way
Kitchener
(519) 258-7655
C0009
David
Powell
187 Suffolk Ln.
Toronto
(647) 998-5557
C0010
Matt
Hirsch
305 - 14th Ave. S.
Kitchener
(519) 334-6654
CustomerID
First Name
Last Name
Address
City
Phone Number
C0001
Eileen
Faulkner
2732 Baker Blvd.
Toronto
(647) 334-5678
C0002
Scott
Wit
120 Hanover Sq.
Ottawa
(613) 358-3364
Explanation / Answer
**Creating listofcities table:
CREATE TABLE listofcities (city varchar(20));
**Inserting unique cities names from customer to listofcities :
INSERT INTO listofcities (city)
SELECT DISTINCT City
FROM customer;
**Comment for any further queries. Upvote if the answer is satisfactory.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.