Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a Products table ( ProductID , ProductName, Price ) and Sales table ( SaleID , ProductID, Quantity ) . Find all products that have

Consider a Products table (ProductID, ProductName, Price) and Sales table (SaleID, ProductID, Quantity). Find all products that have never been sold.
SELECT ProductName FROM Products WHERE ProductID NOT IN (SELECT ProductID FROM Sales);
B
SELECT ProductName FROM Products WHERE ProductID IN (SELECT ProductID FROM Sales WHERE Quantity =0);
C
SELECT ProductName FROM Products P WHERE EXISTS (SELECT * FROM Sales S WHERE S.ProductID = P.ProductID);
D
SELECT P.ProductName FROM Products P LEFT JOIN Sales S ON P.ProductID = S.ProductID WHERE S.ProductID IS NOT NULL;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions