Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Print the suppliers IDs and suppliers Names of suppliers who do not supply Tofu (i.e., if a supplier supplies Tofu, his id and name should

 Print the suppliers’ IDs and suppliers’ Names of suppliers who do not supply Tofu (i.e., if a supplier supplies Tofu, his id and name should not be in the result set).

Question 2: Print all the suppliers’ IDs, and suppliers’ Names who supply a product with a price greater than 30 and an order Quantity greater than 10. Write this query as a flat select statement.

Question 3: Write the same query in Q2 as nested select statement (i.e., use subqueries to avoid all JOIN clauses and JOIN conditions).

Question 4: Print the products’ IDs and average Quantities for products that are ordered with an average quantity greater than the average quantity ordered from product 5.

Question 5: Write an equivalent query for the following query:

SELECT orderid

FROM ORDERDETAILS WHERE EXISTS ( SELECT *

FROM PRODUCTS

WHERE PRODUCTS.productid = ORDERDETAILS.productid AND EXISTS ( SELECT *

FROM SUPPLIERS

WHERE SUPPLIERS.supplierid = PRODUCTS.supplierid

AND SUPPLIERS.country = 'UK' ));

Note: an equivalent query achieves the same semantic and results of the original query.

student submitted image, transcription available below 

EMPLOYEES PK EmployeelD LastName FirstName BirthDate Photo Notes ORDERS PK OrderiD FK1 CustomerlD FK2 EmployeelD FK3 ShipperlD OrderDate SHIPPERS PK ShippertD ShipperName Phone CUSTOMERS CustomerlD CustomerName ContactName Address City PK PostalCode Country H+ UREVER Database ORDERDETAILS PK OrderDetaillD FK1 OrderID FK2 ProductID Quantity SUPPLIERS PK SupplierID CATEGORIES PK CategoryID SupplierName ContactName HO Address City CategoryName Description PRODUCTS PK ProductID ProductName FK1 CategoryID HFK2 Supplier Unit Price Table name Customers Categories Employees Order Details Orders Products Shippers Suppliers Records 91 8 10 518 196 77 3 29

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To achieve this you would typically use a SQL query if youre working with a relational databa... blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant Navathe

7th Edition

0133970779, 978-0133970777

More Books

Students also viewed these Operating System questions

Question

How do direct labor costs flow through a job-order costing system?

Answered: 1 week ago