3. Write a SELECT statement that returns the category_name column from the Categ
ID: 3563277 • Letter: 3
Question
3.
Write a SELECT statement that returns the category_name column from the Categories table.
Return one row for each category that has never been assigned to any product in the Products table. To do that, use a subquery introduced with the NOT EXISTS operator.
3.
Write a SELECT statement that returns the category_name column from the Categories table.
Return one row for each category that has never been assigned to any product in the Products table. To do that, use a subquery introduced with the NOT EXISTS operator.
Explanation / Answer
Hi your queries. Please check and ask if any doubts or corrections required.
3. SELECT category_name FROM Categories
SELECT * FROM categories
WHERE NOT EXISTS(SELECT * FROM Products WHERE product_category=category_name)
4.SELECT email_address,order_id,SUM(order) AS [Order Total]
FROM Order_Items
GROUP BY email_address,order_id
SELECT TOP 1 email_address,[Order Total]
FROM (SELECT email_address,order_id,SUM(order) AS [Order Total]
FROM Order_Items
GROUP BY email_address,order_id) x
ORDER BY [Order Total] Desc
5. SELECT product_name, discount_percent
FROM products
WHERE discount_percent IN (SELECT discount_percent
FROM products GROUP BY discount_percent HAvING COUNT(*) =1)
ORDER BY product_name
6. SELECT email_address,order_id,order_date
FROM Products a
WHERE order_date = (SELECT MIN(b.order_date) FROM Products b
WHERE a.email_address=b.email_address)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.