What results should the query produce?

You have a table named Subcategories that contains subcategories for socks, vests and helmets. You
have another table named Products that contains products only from the subcategories socks and
vests.
You have the following query:
SELECT s.Name, p.Name AS ProductName
FROM Subcategories s
OUTER APPLY
(SELECT *
FROM Products pr
WHERE pr.SubcategoryID = s.SubcategoryID) p
WHERE s.Name IS NOT NULL;
You need to predict the results of the query.
What results should the query produce?

You have a table named Subcategories that contains subcategories for socks, vests and helmets. You
have another table named Products that contains products only from the subcategories socks and
vests.
You have the following query:
SELECT s.Name, p.Name AS ProductName
FROM Subcategories s
OUTER APPLY
(SELECT *
FROM Products pr
WHERE pr.SubcategoryID = s.SubcategoryID) p
WHERE s.Name IS NOT NULL;
You need to predict the results of the query.
What results should the query produce?

A.
Name ProductName
Socks
Mountain Bike Socks,
Socks Mountain Bike Socks,
Socks Racing Socks, M
Socks Racing Socks, L
Vests Classic Vest, S
Vests Classic Vest, M
Vests Classic Vest, L

B.
Name ProductName
Socks
Mountain Bike Socks,
Socks Mountain Bike Socks,
Socks Racing Socks, M
Socks Racing Socks, L
Vests Classic Vest, S
Vests Classic Vest, M
Vests Classic Vest, L
Helmets NULL

C.
Name ProductName
Socks

Mountain Bike Socks,
Socks Mountain Bike Socks,
Socks Racing Socks, M
Socks Racing Socks, L
Vests Classic Vest, S
Vests Classic Vest, M
Vests Classic Vest, L
Helmets NULL
NULL NULL

D.
Name ProductName
Socks
Mountain Bike Socks,
Socks Mountain Bike Socks,
Socks Racing Socks, M
Socks Racing Socks, L
Vests Classic Vest, S
Vests Classic Vest, M
Vests Classic Vest, L
NULL Mountain Bike Socks,
NULL Mountain Bike Socks,
NULL Racing Socks, M
NULL Racing Socks, L
NULL Classic Vest, S
NULL Classic Vest, M
NULL Classic Vest, L
Helmets NULL
NULL NULL



Leave a Reply 0

Your email address will not be published. Required fields are marked *