Question
/* Still remember Problem 5 assignment of Chapter 2 (in Module 2) using ClearWater database? 5. By examining data of Products table without writing and
/* Still remember Problem 5 assignment of Chapter 2 (in Module 2) using ClearWater database?
5. By examining data of Products table without writing and executing an SQL query (which we will learn in a later chapter), which suppliers supply the most different products? Write their ID and contact name.
Hint: the correct answer should contain only two suppliers.
--> Correct output of this query for Problem 5 is: 7 Ian Devling, 12 Martin Bein
Now, after studying summary query techniques of SQL in Chapter 5, can you write one SELECT statement to solve Problem 5 printed above? */
HERE IS THE QUERY I'M RUNNING:
use ClearWater
--Your SELECT statement for Problem 5 (i.e., suppliers who supply more different products than all others) SELECT Suppliers.SupplierID, Suppliers.ContactName FROM Suppliers INNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID WHERE Products.ProductID NOT IN (SELECT Products.ProductID FROM Products INNER JOIN Suppliers ON Suppliers.SupplierID = Products.ProductID);
The output of my query displays 48 results. How should I fix my query to match the output stated in the above question?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started