Which query should you use?

You have a database that contains two tables named ProductCategory and ProductSubCategory.
You need to write a query that returns a list of product categories that contain more than ten sub-categories.
Which query should you use?
A. SELECT [Name]
FROM ProductSubCategory
WHERE ProductCategoryID IN (SELECT ProductCategoryID
FROM ProductCategory)
GROUP BY [Name]
HAVING COUNT(*) > 10
B. SELECT [Name]
FROM ProductCategory c
WHERE NOT EXISTS (SELECT ProductCategoryID
FROM ProductSubCategory
WHERE ProductCategoryID = c.ProductCategoryID
GROUP BY ProductCategoryID
HAVING COUNT(*) > 10)
C. SELECT [Name]
FROM ProductSubCategory
WHERE ProductCategoryID NOT IN (SELECT ProductCategoryID
FROM ProductCategory)
GROUP BY [Name]
HAVING COUNT(*) > 10
D. SELECT [Name]
FROM ProductCategory c
WHERE EXISTS (SELECT ProductCategoryID
FROM ProductSubCategory
WHERE ProductCategoryID = c.ProductCategoryID
GROUP BY ProductCategoryID
HAVING COUNT(*) > 10)

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.