Will you be able to solve this question in SQL? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Will you be able to solve this question in SQL?

The marketing department wants to focus on the customers from North America first. Gets the ID, last name and country of all customers. Build the list by bringing up the customers living in Canada and in the USA first, and finally ordered them by ID. Tip: Use the IN expression in the ORDER BY clause.

9th Feb 2016, 7:16 AM
Meri
Meri - avatar
5 Answers
+ 2
Select CustomerID, Lastname, Country from Customers order by Country IN (' U', 'Canada'), CustomerID ; this works....i even tried !!!
3rd Apr 2016, 12:18 AM
Kishor Tiwari
Kishor Tiwari - avatar
0
Select CustomerId,LastName,Country FROM Customer ORDER BY Country IN ('USA','CANADA') desc, CustomerId
14th Mar 2016, 3:36 AM
abhinav jain
abhinav jain - avatar
0
select ID, Name, Country from customers order by Country in ('US', 'Canada'), ID
15th Apr 2016, 11:30 PM
Selva Kumar
Selva Kumar - avatar
0
can i take u back guys... hw abt if the database contain other countries will they be listed aswel or only USA and Canada?
23rd Aug 2016, 2:26 PM
Thokozani Chilongo
Thokozani Chilongo - avatar
0
Select ID, Lastname, Country from Customers order by Country IN ('USA', 'Canada'), ID;
4th Oct 2016, 5:13 AM
Isuru Prabath
Isuru Prabath - avatar