O
O
Optimus2016-03-29 07:46:04
MySQL
Optimus, 2016-03-29 07:46:04

How to follow the first normal form rule?

One of the 1NF rules says:
" no two rows can be identical "
Consider a table "enterprise working hours" of 3 columns
id - enterprise identifier
timeopen and timeclode - opening and closing times (end and beginning of the working day)
Formally, they are different for many - someone works from 8:00, 8:30, 9:00, 9:30, 10:00, etc. + the same with the end time. And there are exotic options like lunch from 12:00 to 12:45. But with a large number of enterprises, repetitions will definitely appear in the table, and the more enterprises, the more repetitions ...
Question: how to correspond to 1NF in this case and is this correspondence necessary (reasonably)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Entelis, 2016-03-29
Pyan @marrk2

Under "there are no repeating lines" in a crooked Russian translation, "there are no repeating tuples" is meant.
The values ​​in the fields can, of course, be the same.
Since "id - enterprise identifier" you want to believe is unique, then by adding a unique key to the id field you will comply with this requirement.

L
look2009, 2016-03-29
@look2009

enterprise id is md5($nameorg.$idorg); or simpler id = idorg and no auto-increment in this table.

A
AVKor, 2016-03-29
@AVKor

Question: how to correspond to 1NF in this case and is this correspondence necessary (reasonably)?

Before you try to work with the database, first read any book on them.
So that there are no such strange questions.
Unless in this table id can be the same for different enterprises (and for id, PK, as it were, suggests itself), it will certainly be in 1NF.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question