Sunday, 27 March 2011

exercise dadd

                                                                        QUESTION 1
a) What is the definition of relational key and why it is needed?

Definition: A key consists of one or more attributes that can be identified in a row. Relational key  is an attribute that relates one identify with another entity in a relationship.


 Why needed : Relational key enable us to link the tables together in a database for easier data access storage.

2. List and explain 4 types of relational keys.
         i.                               i.)            Candidate key
                   ii.)            Primay key
                  iii)             Foreign key
                 iv)           Composite key


3.Based on the table given below, answer all the following questions:
BORROWER:  Table

BORROWER ID
BORROWER NAME
CONTACT NO

ADDRESS
CATEGORY
AGE
DATE OF BIRTH
01-200506-003
Ali Ahmad
03-12345678
Sentral
Student
18
02-februari
01-200506-012
Aminah Hassan
03-45725575
Bandar Baru Bangi
Student
20
15-februari

   a)      What is the name for the above table? Borrower


b)      What is the primary key for the above table? Borrower ID

c)       What is data type for borrower’s name, category, age and data of birth colums? Text,text,number,date/time

d)      How many attribute and records contains in the table? 6

e)      What is the function of field size,input mask, and default solve?
                                                                      QUESTION 2
Based on the following diagram below, draw a complete entity relationship diagram (ERD) which includes entity,attributes, relationship, cardinality constraints and key attributes.

     Report On Retail Details
Owner no: 40612
Owner name: Fatimah Abd Rahman
HOUSE CODE

ADDRESS
RENTAL RATE
TORANT CODE
TENANT NAME
START DATE
END
 DATE
H0021
Sentul
RM 560
T0621
Ali
01//10/04
30/09/05
H0022
Kajang
RM 660
T0022
Aminah
01/12/04
30/11/05
H0023
Bangi
RM 850
T0623
Stephen
01/01/04
31/12/04

Attibute:                                                         
Owner _no (PK)                                       
Owner_name                                                   
                                                                       
House code (PK)
Address
Rental_Rate

Torant code (PK)
 Terant_name
 Start_ Date
 End_ date
 ENTITY:-
  • owner
  • house
  • tenant








 
                                                                        QUESTION 3
Every day, there are five doctor is on duty in orthopaedic words. There are working on shift and doctor can give a treatment to their patient and each patient can received a treatment from many doctor based on type of diseases. A patient can take a medicine but much medicine could be taken by many patients.

         i.                                 i)            Doctor information is DoctorID and Doctor Name
                   ii)            Patient information is PatientID, patient name, and address
                  iii)            Medicine information is medicineCode and medicine name.
                 iv)            For each treatment, it had TypeofTreatment and CostofTreatment
                   v)            For each accepted medicine, it has a Quantity and date 

No comments:

Post a Comment