Starting from:
$30

$24

Homework 1 Solution




Question 1




Let A, B be sets. Let the complement of B be denoted by B.




Prove that A – B = A ∩ B.



Let ∩= ∅ . Show that ∩ =



Prove or disprove that if ( × ) = ( × ), then = .
List the elements of the following sets.



(∅)



({∅})



( ( (∅)))



{∅} × (∅)



∅ × (∅)



Question 2




The symmetric difference A⊕ B between two sets A and B is the set of all elements that are in either A or B, but not in both.




Find the symmetric difference between {1, 3, 5} and {1, 2, 3}



Prove that A⊕ B = (A ∪ B) – (A ∩ B)



Prove that A⊕ B = (A − B) ∪ (B − A)



Prove that A⊕ B = B ⊕ A



Prove that A⊕ B = (A⊕ B) ⊕ B


















Question 3




Consider the following ER diagram.
















































































































List the strong (nonweak) entity types in the ER diagram.



Is there a weak entity type? If so, give its name, partial key, and identifying relationship.



What constraints do the partial key and the identifying relationship of the weak entity type specify in this diagram?



List all the relationships in the ER diagram, and specify the constraint on each.









Question 4




Design a database for a chain of pharmacies. Here’s the information that you are given. Draw an ER diagram that captures the following information. Identify any constraints not captured by the ER diagram.




Patients are identified by an SSN. Their names, addresses, and ages must be recorded.



Doctors are identified by an SSN. For each doctor, the name, specialty, and years of experience must be recorded.



Each drug manufacturer is identified by name and has a phone number.



For each drug, its trade name and formula must be recorded.
Each drug is sold by a drug manufacturer. The drug’s trade name identifies a drug uniquely among all the products of that manufacturer. If a drug manufacturer is deleted, you need not keep track of its products any longer.
Each pharmacy has a name, address, and phone number.



Each pharmacy sells many drugs and has a price for each. A drug could be sold at many pharmacies. Its price could vary from one pharmacy to another.



Every patient has a doctor. Every doctor has at least one patient.



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, only the last such prescription needs to be stored.
Drug manufacturers have contracts with pharmacies. A drug manufacturer can have contracts with several pharmacies, and a pharmacy can contract with several drug manufacturers. For each contract, you have to 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.

More products