Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Database Theory > Re: Identifying...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 11 Topic 2489 of 2676
Post > Topic >>

Re: Identifying candidate keys and primary keys

by Philipp Post <Post.Philipp@[EMAIL PROTECTED] > Apr 15, 2008 at 08:01 AM

> We have a patient medication form from an hospital with these:
> Heading: Patient number, Full name, Bed number, Ward number, Ward
> name.
> Then a table with this columns: drug number, name, description,
> dosage, method of admin, units per day, start date, finish date.
>
> I have to find all the candidate keys and primary keys.

I would assume it will make it easier first to define the tables, and
then the keys. As the requirements were quite vague, my guess (without
prejudice) here. Play with it a bit and see if it leads to an answer.

Patients
-----------
PatientNumber - Primary key
FirstName \ bad candidate key if two persons have the same name
LastName /

Wards
---------
WardNumber - Primary key
WardName - candidate key (?) No idea if the name is unique, but it is
likely.

PatientLocations
-----------------------
PatientNumber  --- \
WardNumber --- composite primary key
BedNumber --- /

I could imagine a patient can change the ward during its stay in
hospital, so might add StartDate, EndDate pair, but that was not
mentioned in the specification.

Drugs
-----------
DrugNumber - Primary key
DrugName  - candidate key (?) Is a drug name always unique?
DrugDescription

Treatments
----------------
PatientNumber \
DrugNumber --- composite primary key
StartDate       /
FinishDate    /
Dosage
MethodOfAdmin
UnitsPerDay

I would assume that the same drug can be given through out several
periods of time, therefore I put the dates into the PK.

Brgds

Philipp Post
 




 11 Posts in Topic:
Identifying candidate keys and primary keys
"noagbodjivictor@[EM  2008-04-13 02:29:27 
Re: Identifying candidate keys and primary keys
"Brian Selzer"   2008-04-13 07:05:20 
Re: Identifying candidate keys and primary keys
"David Cressey"  2008-04-13 11:51:23 
Re: Identifying candidate keys and primary keys
"noagbodjivictor@[EM  2008-04-13 13:02:41 
Re: Identifying candidate keys and primary keys
"David Cressey"  2008-04-13 21:40:53 
Re: Identifying candidate keys and primary keys
Bernard Peek <bap@[EMA  2008-04-16 22:07:18 
Re: Identifying candidate keys and primary keys
"Brian Selzer"   2008-04-13 21:50:31 
Re: Identifying candidate keys and primary keys
rpost@[EMAIL PROTECTED]   2008-04-16 18:59:12 
Re: Identifying candidate keys and primary keys
"Brian Selzer"   2008-04-17 01:05:35 
Re: Identifying candidate keys and primary keys
Philipp Post <Post.Phi  2008-04-15 08:01:04 
Re: Identifying candidate keys and primary keys
JOG <jog@[EMAIL PROTEC  2008-04-19 18:45:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 6:59:06 CST 2008.