GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 12-Oct-2003, 00:18
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point

SQL statement


can someone help me the sql queries, i'm not very expert in sql, thank you very much.

a) Patients identified by a MRN. Their names, addresses and ages must be recorded.
b) Doctors are identified by an MRN. For each doctor, the name specialty and years of experience must be recorded
c) Each pharmaceutical company is identified by name and has a phone number
d) For each drug, the trade name and formula must be recorded. Each drug is sold by a given pharmaceutical company, and the trade name identifies a drug uniquely from among the products of that company. If a pharmaceutical company is deleted, you need not keep track of its products any longer
e) Each pharmacy has a name, address and phone number
f) Every patient has a primary physician. Every doctor has at least one patient
g) Each pharmacy sells several drugs, and has a price for each. A drug could be sold at several pharmacies, and the price could vary from one pharmacy to another
h) Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs for several patients and a patient could obtain prescriptions from several doctors. Each prescription has a date and a quantity associated with it. If a doctor prescribes the same drug for the same patient more than once, several such prescriptions need to be stored
i) Pharmaceutical companies have long-term contracts with pharmacies. A pharmaceutical company can contract with several pharmacies, and a pharmacy can store a start date, an end date, and the text of the contract
j) Pharmacies appoint a supervisor for each contract. There must always be a supervisor for each contract, but the contract supervisor can change over the lifetime of the contract.


Questions:
i) Find the current pharmacy that sells the most number of drugs and its total number.
ii) Provide an alphabetical list of all the pharmaceutical companies and their products in trade name order
iii) Find the drug(s), which is frequently prescribed by doctors.
iv) List the doctor(s) with the least patients and all his patient names.
  #2  
Old 12-Oct-2003, 06:29
jrobbio's Avatar
jrobbio jrobbio is offline
Regular Member
 
Join Date: Jan 2003
Location: Loughborough, England
Posts: 840
jrobbio will become famous soon enough
I think your asking far too much their skyloon, are you expecting others to do all your work for you? Just keep your questions to individual queries in the future and you are more likely to get a response.

Rob
  #3  
Old 12-Oct-2003, 06:48
skyloon skyloon is offline
Junior Member
 
Join Date: Jun 2003
Posts: 53
skyloon is an unknown quantity at this point
sorry...

this is my normalization form, don't know whether correct or not, i have tried my best

Appointment (AppointmentNo, DoctorMRN, PatientMRN, Date, StartTime, EndTime)

Contract (ContractNo, PharmaceuticalID, SupervisorID, PharmacyID, StartDate, EndDate, ContractText)

Doctor (DoctorMRN, Name, Specialty, YearsOfExperience)

Drug (TradeName, PharmaceuticalID, PrescriptionNo, Formula, Price)

Patient (PatientMRN, Name, Address, Age)

Pharmaceutical (PharmaceuticalID, Name, PhoneNo)

Pharmacy (PharmacyID, Name, Address, PhoneNo)

Prescription (PrescriptionNo, DoctorMRN, PatientMRN, Date, Quantity)

Sales (SalesID, PharmacyID, TradeName, Quantity)

Supervisor (SupervisorID, PharmacyID, Name)


the questions are very difficult, can you help me?
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL multiple languages query samtediou MySQL / PHP Forum 6 23-Jul-2003 13:09
3 line sql querry causes error, but i cant find the raeson norok MySQL / PHP Forum 2 01-Jul-2003 09:06
Thanx for the sql query, but there must be a little mistake norok MySQL / PHP Forum 13 30-Jun-2003 06:30
mysql vs sql - what is the difference zabell MySQL / PHP Forum 2 14-Jun-2003 16:32
Difference between MySQL and SQL pcxgamer MySQL / PHP Forum 2 14-Apr-2003 12:07

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:30.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.