Print the suppliers IDs and suppliers Names of suppliers who do not supply Tofu (i.e., if a
Question:
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.
Fundamentals Of Database Systems
ISBN: 9780133970777
7th Edition
Authors: Ramez Elmasri, Shamkant Navathe