Tables (1) (2) Tables (1) (2) Vendor VID Name City State ZIPcode Phone 1222 CREA
ID: 3753438 • Letter: T
Question
Tables
(1)
(2)
Tables
(1)
(2)
Vendor VID Name City State ZIPcode Phone 1222 CREATIVE WOOD Madison WI 53400 6122323344 2333 INDIANA DESK Milwaukee WI 53209 8148970956 3444 PACKARD Columbus OH 43432 6046334567 4535 TRENDWALL Detroit MI 48300 3132348765 4555 CUMBERLAND Benton Harbor MI 48500 2693450987 5555 CUSTOM COMFORT Springfield IL 60432 6265435543 5666 CUSTOM DESK INC. Normal IL 60890 2122122121 7676 UNITED RECEPTACLE Arcadia IN 46025 6129987654 8999 TRENDWAY Chicago IL 60626 8474788796 8 List Vendor's VID and Name for vendors who have some product(s) never purchased by any customers Hint: You will need to use Vendor and Product to ensure that a vendor has some products in store, and use NOT IN to find out if any product not sold in any orders Name your SQL statement under the name Query8, then copy your query and its results into the Word document under the subheading Query8.Explanation / Answer
1. SELECT v.VID, v.Name FROM Vendor v, Product p, Order o WHERE v.VID = p.VID and p.PID NOT IN (SELECT PID FROM Order);
NOTE: This query might not work since I could find any table amongst the ones which have provided which has a foreign key to Product PID column. As a result, I cannot possibly know how to find order which is not found in any of the orders. If you can provide me additional details, I can update the query.
2. SELECT c.CID, c.Lname, c.Fname, sum(o.Qty * p.Price) From Customer c, Order o, Product p, CustOrder co WHERE co.CID = c.CID AND co.SalesID = o.SalesID AND o.PID = p.PID GROUP BY co.CID;
NOTE: Again, this query might not work since the tables provided by you are not enough to answer this problem. Hence, i am just providing a sample query, your final query will look something like this.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.