dbTalk Databases Forums  

Identifying candidate keys and primary keys

comp.databases.theory comp.databases.theory


Discuss Identifying candidate keys and primary keys in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #41  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM







<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #42  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM







<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #43  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM




<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #44  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM




<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #45  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM




<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #46  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-13-2008 , 08:50 PM




<noagbodjivictor (AT) gmail (DOT) com> wrote

Quote:
On Apr 13, 7:05 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
noagbodjivic... (AT) gmail (DOT) com> wrote in message

news:fc37fe0e-476b-4a0b-8396-ab81c9a5f4a1 (AT) u69g2000hse (DOT) googlegroups.com...



Hello guys, this one is for one of my assignments. I want explanations
and hints only.

I'm still confused with the concepts of candidate keys and primary
key. 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 think
candidate keys are the minimal superkeys.

I have found {Patient number, Ward number, Ward name}. I have excluded
{Patient number, Ward number, Ward name, Full name} and {Patient
number, Ward number, Ward name, Full name, Bed number} which are also
superkeys but contain more attributes.

Can a patient be in more than one ward (at the same time)?

This means that I have found only one candidate key, and this is also
the primary key I have found (a composite).

Since the question was "identify all the candidate keys" I thought
maybe I dont really understand the concepts...

http://en.wikipedia.org/wiki/Candidate_key

thanks for any help.

Brian, I don't really know...

I have been looking at how hospitals work here in US. From what I have
learned online, I don't think it's possible to have a patient in
multiple ward at the same time (and I can't confirm).

Also from what I have learned it seems like the ward names are unique
in hospital. It probably means that a ward number assigned to a name
is also unique. So that when we take a name, we have the number. But I
can't confirm that either, I have found all this by searching
online...
Unless you can identify the functional dependencies, you won't be able to
identify the candidate keys. If you don't know enough about the subject
matter (or weren't provided with that information as part of the
assignment), then you might as well join Bluto.





Reply With Quote
  #47  
Old   
Philipp Post
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-15-2008 , 10:01 AM



Quote:
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


Reply With Quote
  #48  
Old   
Philipp Post
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-15-2008 , 10:01 AM



Quote:
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


Reply With Quote
  #49  
Old   
Philipp Post
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-15-2008 , 10:01 AM



Quote:
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


Reply With Quote
  #50  
Old   
Philipp Post
 
Posts: n/a

Default Re: Identifying candidate keys and primary keys - 04-15-2008 , 10:01 AM



Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.