Question
Write the SQL queries that would answer the questions. Do not turn in output. The homework will require an SQL query. E.g.: Find all customers
Write the SQL queries that would answer the questions. Do not turn in output. The homework will require an SQL query. E.g.: "Find all customers from 'Duluth'", do not answer: "TipTop and ACME". I want to see: SELECT cid, cname FROM tblCustomers WHERE city = 'Duluth'; Some will require a table join and some won't. Do not us a table join unless you must. 1) What products (pid, pname) come from "Dallas"? 2) Which Orders were placed by Customers from Dallas? (ordno, cid, cName) 3) What products (pid only) were ordered by the Customer with cname "ACME" and city "Duluth" (that is all you know; you don't know the cid) Of course, the query will have to be able to resolve the cid, but you can't code it into the query is all. 4) Which Orders are served by "agent Smith"? Show ordNo and aid... and there may be more than one "agent Smith"... like in the Matrix. Number your queries and separate them such that they're easy to read. Format is 20%. Do not shorten the syntax. An INNER JOIN is correctly written: SELECT * FROM table_A AS a INNER JOIN table_B AS b ON a.pk=b.pk; Renaming the tables is optional: SELECT * FROM table_A INNER JOIN table_B ON table_A.pk = table_B.pk; is OK (if you like typing). -- ------------------------------ It is not acceptable to write: SELECT * FROM table_A a JOIN table_B b ON a.pk=b.pk;
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