AdventureWorks Database: Fetch any distinct values from left query of EXCEPT that aren't present in the query to the right

SQL Query - AdventureWorks: Exercise-134 with Solution

134 From the following tables write a query in SQL to fetch any distinct values from the left query that aren't also present in the query to the right.

Sample table: production.Product

Click to view Full table

Sample table: production.WorkOrder

Click to view Full table

Sample Solution:

SELECT ProductID   
FROM Production.WorkOrder  
SELECT ProductID   
FROM Production.Product ;

Sample Output:


N.B. : No result returns here

SQL AdventureWorks Editor:

Practice Online

Contribute your code and comments through Disqus.

Previous: Return any distinct values from first query, not found on the 2nd query.
Next: A distinct businessentityid must be returned by both queries.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Share this Tutorial / Exercise on : Facebook and Twitter

SQL: Tips of the Day

Convert Timestamp to date in MySQL Query:

DATE_FORMAT(FROM_UNIXTIME(`user.registration`), '%e %b %Y') AS 'date_formatted'

Database: MySQL

Ref : https://bit.ly/3EJPnMQ