W
W
wideShift2021-12-01 12:18:22
Database design
wideShift, 2021-12-01 12:18:22

Is 3rd normal form violated in these examples?

Example No. 1
There is a users table with the following fields:
id (PK), Last name, First name, Middle name, City
Example records:
1, Ivanov, Ivan, Ivanovich, Moscow
2, Petrov, Ivan, Ivanovich, St. Petersburg
3, Sidorov, Ivan , Ivanovich, Moscow The
question is:
Here the City field does not depend on another non-key field, so there are no violations?
I understand that it would be better to put this field in a separate table directory, and put city_id here.

Example No. 2
There is a users table with the following fields:
id (PK), login, Date of birth
Record examples:
1, ivanov, 01/01/2000
2, petrov, 01/01/2001
3, sidorov, 01/01/2002 The
question is the following:
If the login field in the database is not defined unique (not a key), then 3NF is violated because the date of birth depends on the login?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tomulevich, 2021-12-14
@phoinixrw

In a relational model, in principle, there can be no dependencies on a non-key.
Which means that the date of birth cannot depend on the login, it depends on the id.
3NF is not violated here, since it simply does not exist here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question