Question: Section 1 Using SQL , create tables according to the given schema shown in Figure 1 . Figure 1 : doctor ( dssn , dname,

Section 1
Using SQL, create tables according to the given schema shown in Figure 1.
Figure 1:
doctor (dssn, dname, specialty) prescription( dssn, pre_no, pdate) foreign key (dssn) references to doctor(dssn) ph_company( pname, phone) drug (pname, trade_name, formula) foreign key (pname) references to ph_company(pname) consist_of ( dssn, pre_no, pname, trade_name) foreign key (dssn, pre_no) references prescription(dssn, pre_no), foreign key (pname, trade_name) references drug(panme, trade_name) pharmacy (pcy_name, address, phone) sell (pharmacy_name, pname, trade_name, price) foreign key (pname, trade_name) references drug (pname, trade_name), foreign key (pharmacy_name) references pharmacy(pcy_name)
Section 2
Populate the database. Please check sections 3 for details.
Section 3
Use SQL to specify the following queries. When you populate the database, insert data such that at least two rows will be display as the result of running each query.
1) Retrieve the drugs information (trade name and formula) which are manufactured by company Pfizer. Order the result by trade name in descending order.
2) List drug information (Pharmaceutical company name, trade name, formula) that has been prescribed by at least one doctor.
3) Obtain all the prescription drugs (trade name, company name and prescription date) given by Doctor Kate Elmasri.
4) Retrieve all the drugs (trade_name, formula) sold by Walmart.(Walmart is pharmacy name).
5) Retrieve number of type of drugs made by Pfizer.(Type is distinguished by trade_name).
6) Obtain information (pharmacy name, address) of pharmacy that sells Ibuprofen with the highest price among all pharmacies. (Ibuprofen is a trade name)
7) Retrieve the pharmacies that sell more than 2 types of drugs. List pharmacy name and number of types of drugs sold. (Type is distinguished by trade_name. However, if two drugs with the same trade name are produced by two different pharmaceutical companies, they are considered as two different types of drugs.)
Section 4
Specify the statements to drop all the tables. Pay attention to the order of the drop statements in order to drop everything successfully.
Section 1 Using SQL , create tables according to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!