Question: Write SQL queries to answer the following questions. 1.What agents (aid, aname) placed an order (or orders) for razor? aid | aname -----+------- a06 |

Write SQL queries to answer the following questions. 

1.What agents (aid, aname) placed an order (or orders) for "razor"?
aid | aname
-----+-------
a06 | Smith
a03 | Brown
a05 | Otasi
(3 rows)

 

2.What products (pid, pname) are supplied by "Lambda Supply"? (Hint:
tblSuppliers, tblProductSupplier,
and tblProducts. You do not need tblOrders.
pid | pname
-----+-------
p04 | pen
p02 | brush
(2 rows)

 

3.What products (pid, pname) have no orders? (Childless Parent query)
(Show only the requested information.)
pid | pname
-----+--------
p08 | floppy
(1 row)

 

4.Find all invalid foreign keys in tblProductSupplier. (Remember, it has a
two-field PK)
This one will take two queries: one on tblProducts (parent) ---
tblProductSupplier (child)
and one on tblSuppliers (parent) --- tblProductSupplier (child)

 

 

pid
-----
p09
(1 row)
sid
-----
s08
(1 row)

 

Step by Step Solution

3.41 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are the SQL queries to answer the provided questions 1 What agents aid aname placed an order or ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!