10 Return for each customer the customer ID and region sort the rows in the output by region having NULLS sort last (after non-NULL values) -- Note that the default in T-SQL is that NULLS sort first Tables involved: Sales. Customers table 55 10 Desired output: region custid AK BC

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

SQL homework

Please help me with this SQL homework

173 -- 10
174 -- Return for each customer the customer ID and region
175 -- sort the rows in the output by region
176 -- having NULLS sort last (after non-NULL values)
177 -- Note that the default in T-SQL is that NULLS sort first
178 Tables involved: Sales. Customers table
179
180 Desired output:
181 custid
region
182
183 55
184 10
185 42
186 45
187 37
188 33
189 71
190 38
191 46
192 78
193...
194 1
195 2
196 3
197 4
1985
199 6
200 7
2018
AK
BC
BC
CA
Co. Cork
DF
ID
Isle of Wight
Lara
MT
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
202 9
203 11
204...
205
206 (91 row(s) affected)
Transcribed Image Text:173 -- 10 174 -- Return for each customer the customer ID and region 175 -- sort the rows in the output by region 176 -- having NULLS sort last (after non-NULL values) 177 -- Note that the default in T-SQL is that NULLS sort first 178 Tables involved: Sales. Customers table 179 180 Desired output: 181 custid region 182 183 55 184 10 185 42 186 45 187 37 188 33 189 71 190 38 191 46 192 78 193... 194 1 195 2 196 3 197 4 1985 199 6 200 7 2018 AK BC BC CA Co. Cork DF ID Isle of Wight Lara MT NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 202 9 203 11 204... 205 206 (91 row(s) affected)
Expert Solution
Step 1: Introduction

As per the given question, we need to write a SQL query to return for each customer the customer ID and region, sort the rows in the output by region, having NULLS sort Last (after non-NULL values). 

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education