SQL statement needed:
List the CompanyName of the suppliers and the number of products they supply if they supply more 3 or more products to only 1 product category.
For the Order Details table in the northwind database, you will need to enclose the name of the table in quotes like this `Order Details` or double click the name of the table in the left hand list of schemas to get the table name to show up appropriately.
Solution:
There are 3 tables from the Northwind Database that will be required to display the corresponding output for the query in question.
List the CompanyName of the suppliers and the number of products they supply if they supply more 3 or more products to only 1 product category.
Namely,
1. Products
2. Categories
3. Suppliers
Note:
I don’t think Order Details table is required for this instance.
SQL STATEMENT
-- List of Suppliers who supply 3 or more Products in the Same Category –
SELECT Suppliers.CompanyName as "Supplier", Categories.CategoryName as "Category", COUNT(Products.ProductID) AS "Products"
FROM Products, Categories, Suppliers
WHERE products.CategoryID = Categories.CategoryID
AND Products.SupplierID = Suppliers.SupplierID
GROUP BY Categories.CategoryName, Suppliers.CompanyName
HAVING COUNT(Products.ProductID)>=3;
-- Display Data without CatergoryName -(as per Question)--
SELECT Suppliers.CompanyName as "Supplier", COUNT(Products.ProductID) AS "Products"
FROM Products, Categories, Suppliers
WHERE products.CategoryID = Categories.CategoryID
AND Products.SupplierID = Suppliers.SupplierID
GROUP BY Categories.CategoryName, Suppliers.CompanyName
HAVING COUNT(Products.ProductID)>=3;
OUTPUT SCREENSHOT

***Hope this is what you were looking for.
***Kindly get back to me for clarifications if any.
SQL statement needed: List the CompanyName of the suppliers and the number of products they supply...
Create the following SQL Server queries that access the
Northwind database
Same as problem 3 but, limit the list to all customers who
placed 3 or more orders.
The product id, product name, last date that the product was
ordered for all items in the Grains/Cereals category. (Hint: Use
MAX)
The product ID, product name, and number of distinct customers
who ordered that product in 1996
Thank you.
Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...
In .sql
Given the following relational schemas, answer the following questions: Suppliers(sid: int, sname: VARCHAR(30), address: VARCHAR(50)) Parts(pid: int, pname: VARCHAR(30), color: VARCHAR(10)) Catalog(sid: int, pid: int, cost: double) c. (8 points) List sid, sname, and address of all suppliers who supply at least one part. In other words, the answer must not show sid and sname of any supplier who does not have its sid in the Catalog table d. (4 points) Find all distinct black parts in the...
We are using, Oracle Database 11g Express Edition.
use SQL and the TAL Distrutors database (see figure 1-2 in
chapter 1) to complete the following exercises. if directed to do
so by your instructor, use the information provided with the
chapter 3 exercises to print your output or save it to a
document.
1. list the item number, description, and price for all
items.
2. list all rows and columns for the complete ORDERS table.
3. list the names of...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders has decided to
increase their retail prices. Write a query that shows the product
name, the current price, and the new price. Make sure the new price
is listed to 2 decimal points. Follow below guidelines on new
retail price:
a. If the
category is beverages or dairy products, increase the price by...
The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind Traders, which imports and exports specialty foods from around the world. Here is the schema of the database: Products (ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued); Suppliers (SupplierID, CompanyName, ContactName , ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax, HomePage); Categories (CategoryID, CategoryName, Description, Picture); Orders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName,ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry); Order_details (ID, OrderID,...
can someone solve these quick
please and thank you!
sql chapter 4
Query #1: List the company name, contact name, contact title and
the phone number for customers who HAVE NOT put in an order. Use an
outer join.
Query #2: Create a listing displaying the employee first name,
last name and the full name (First name space Last Name) of the
person they report to (Supervisor). This is a self-join. If an
employee does not report to anyone then...
(1) Use a single SQL statement to create a relational table and to load into the table all information about the orders submitted in 1996 or in 1998 by the customers located in Paris or in London or in Madrid. Next, enforce the appropriate consistency constraints on the new table. (2) Create a new relational table to store information about the company names of all suppliers and the total number of products supplied by each supplier. Enforce, the appropriate consistency...
Please finish all 6 parts. Don't need to do the measure time
things, but you can do it if you wanna do it. Thanks!
Write the following SQL queries and measure their execution time both with and without using indexes 1. Count how many parts in NYC have more than 70 parts on hand 2. Count how many total parts on hand, in both NYC and SFO, are Red 3. List all the suppliers that have more total on _hand...
Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders wants to make
sure that all orders are shipped within 10 days. Display any orders
that were not shipped within 10 days. Include the OrderID, the
OrderDate, and the number of days it took before the order was
shipped.
Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode...