Is it true that a database is 2NF by default if the table only has 1 primary key?
Asked Answered
M

4

1

i.e. there is a table with only 1 primary key (no composite keys). Is it 2NF by default? Assume that it is already 1NF

Mallorie answered 19/4, 2012 at 19:41 Comment(2)
Patno,PatName,appNo,time,doctor say Patno is the primary key. wouldn't this be 2NF? There are no partial key dependencies.Mallorie
Does this answer your question? when a 1NF table has no composite candidate keys is it in 2NF?Illiquid
V
1

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

in your example, PatNo is not a primary key since PatNo may see more than one doctor, or have more than one appNo.

Vinegarroon answered 19/4, 2012 at 20:8 Comment(1)
maybe there's only one doctor? Your answer really doesn't help at all.Mallorie
L
0

Loosely speaking, a table is in 2NF if and only if it's

  • in 1NF, and
  • there are no partial key dependencies.

That's not quite the same thing as saying a table that has a single-column primary key is in 2NF. A table like this

person_id  full_name       phones
--
-43        Ericka Cimini   555-222-1515
                           555-232-6100
-18        Julio Martina   555-123-4567

has a single-column primary key ("person_id"), but it isn't in 1NF. (See wikipedia for details.) And since it's not in 1NF, it can't possibly be in 2NF.

Lascivious answered 19/4, 2012 at 20:25 Comment(1)
No, your question says, "Is [a table with a single-column primary key in] 2NF by default?" Odds are good that a lot of people will remember something about a single-column primary key, and forget the part about 1NF.Mccauley
M
-1

I think got it now.

In my example if there is more than 1 doctor, then doctor is also partially dependent on the patient number because the doctor has to see the correct patient. It's just confusing because doctor is also transitively dependent to patNo via appNo.

Mallorie answered 20/4, 2012 at 18:44 Comment(1)
No, there's no partial key dependency between doctor and patient number in your example. Transitive dependencies have nothing to do with 2NF.Mccauley
K
-1

Maybe this late response might be helpful to others. We were taught (perhaps mistakenly) that irrelevant data also fell under 2NF. So animal(phylum, class, order, family, genus, species, greek_phoneme) would not be in 2NF because Greek phonemes have nothing to do with Animals.

Kellum answered 7/4, 2015 at 1:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.