
Concept explainers
Exercise
The Prescriptions-B-A chain of pharmacies has offered to give you a free lifetime supply of
medicine if you design its
information that you gather:
Patients are identified by an- and their names, middle name, last name, addresses, M/F, and ages
must be recorded. Doctors are identified by a kísh. For each doctor, the name, middle name,
family name, specialty, Department, and years of experience must be recorded. Each
pharmaceutical company is identified by name and has a phone number. 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. Each
pharmacy has a name, address, phone number and location. Every patient has a primary
physician. Every doctor has at least one patient. Each pharmacy sells several and frees 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. 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. You can assume that, if a doctor
prescribes the same drug for the same patient more than once, only the last such prescription
needs to be stored. Pharmaceutical companies have long-term contracts with pharmacies. A
pharmaceutical company can contract with several pharmacies, and a pharmacy can contract
with several pharmaceutical companies. For each contract, you must store a start date, an end
date, and the text of the contract. 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.
Question
1. Draw an E diagram that captures the preceding information. Identify any constraints not
captured by the E diagram.
2. How would your design change if each drug must be sold at a fixed price by all pharmacies?
3. How would your design change if the design requirements change as follows: If a doctor
prescribes the same drug for the same patient more than once, several such prescriptions may
have to be stored.
4. After draw ER. The ER diagram is shown?

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- b) Consider the relational table PARTSUPP of the TPCHR sample database. Find SELECT statements that will use the index in the ways specified in the questions (i) to (iv) below. The values used to create the query such that the queries can meet the specified criteria is up to you, but the values must be sensible. i. ii. iii. iv. Execution of the first SELECT statement must traverse the index vertically then horizontally and it must not access the relational table PARTSUPP. Execution of the second SELECT statement must traverse the index vertically then horizontally and it must access the relational table PARTSUPP. Execution of the third SELECT statement must traverse the leaf level of the index horizontally and it must not access the relational table PARTSUPP. Execution of the fourth SELECT statement must traverse the leaf level of the index horizontally and it must access the relational table PARTSUPP. Deliverables Submit your spooled file solution 1b.lst (or solution 1b.pdf) that…arrow_forwardI am having some trouble with this for an assignment in Database. I am trying to create some queries for this homework: Assignment 5: Data Definition language and Transaction in MySQL This is what I am currently working on: On June 3, 2019, customer ‘10010’ makes a payment of $100 in cash. The payment ID is 3428. The query as it is as of this moment: SELECT PAYMENTINSERT INTO PAYMENT (PMT_ID,PMT_DATE,CUS_CODE,PMT_AMT,PMT_TYPE,PMT_DETAILS)VALUES(3428,6-3-2019,10010,100.00,cash,account),UPDATE CUSTOMERSET CUS_BALANCE = CUS_BALANCE + 100WHERE CUS_CODE=10010,COMMIT 2. On May 11, 2019, customer ‘10012’ makes a credit purchase of one unit of product ‘11QER/31’ with a unit price of $110.00; the invoice total is $118.80. The invoice number is 10983, and this invoice has only one product line. [note: no payment has been made here] The Query as of now: BEGIN TRANSACTION; INSERT INTO VOICE VALUES (10983, 10012, ’5-11-2019’), INSERT INTO LINE VALUES (10983, 1, ‘11QER/31’, 1, 110.00), UPDATE…arrow_forwardIn OES4 database, we can verify the values stored in subtotal field by using the following 1: col gross_sales for 99999999 col subtotal for 99999999 select o.order_no,sum(qty*Unit_cost) Gross_Sales, sum(o.subtotal) subtotal from orders o, orderline ol, product p where o.order_no=ol.order_no and ol.product_no=p.product_no group by o.order_no; II: col gross_sales for 99999999 col subtotal for 99999999 select o.order_no,sum(qty*Unit_cost) Gross_Sales, sum(o.subtotal) subtotal from orders o, orderline ol, product p where o.order_no=ol.order_no and ol.product_no=p.product_no group by o.order_no; I & II: are correct I & II: are not correct | || I & II: are not correct I & II: are correctarrow_forward
- In Oracle database, if we have any field such as Job_Title field in any of our table then we can use DECODE function to sort the result based on our own numerical value. This can be done by including the following in ORDER BY clause: 1: ORDER BY DECODE(job-title,'Manager',3,Assistant',2,'Sales Rep', 1) DESC II: ORDER BY DECODE(job-title,'Manager', 3,'Assistant',2, Sales Rep', 1) ASC III I and II are correct IV I and II are incorrect ||| IV || 1arrow_forwardComputer Science provide SQL code (Use the EBOOKS database) When a course is offered in several sections taught by more than one instructor, students have the ability to choose an instructor, otherwise they have no choice. The deans of each college would like to know how many courses have only one section in the schedule, how many courses have more than 1 section, but taught by the same instructor, how many courses have sections taught by more than one instructor. Sort the results alphabetically by College ID as shown below: COLLEGE SINGLE_SECTION MULTISECTION_ONE_INSTRUCTOR MULTIPLE_INSTRUCTORS CAS 83 21 22 CED 76 8 39 COB 72 16 13arrow_forwardThis is for SQL Give me a list of all of our vendors (by their name) and, if they have an invoice, give me the total number of invoices we have from them and the invoice date of their first invoice. The invoice date results should be provided in a way that shows the date only in the following format: mm/dd/yyyy (e.g. 10/04/2021)arrow_forward
- Composite main keys have candidate keys. Your reaction?arrow_forwardWe have a relational database that contains the table ‘Staff’. The table ‘Staff’ consist of columns ‘Name’, ‘Department’ and ‘Date of Joining’. What query would you use to extract the Names and Department of all staff in the table? a. SELECT * FROM Staff b. a) SELECT Name, Department FROM Staff c. SELECT Name, Department IN Staff d. SELECT * IN Staffarrow_forwardYou have the table T = (name, ssn, phone number) representing a person. Each name is uniquely identified by ssn, but the same name can have multiple phone numbers. Suppose you break the tables into two tables T1=(name, ssn) and T2= (name, phone number) a) What are the candidate keys of T, T1, and T2, respectively?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





