K
K
Katya Smirnova2019-02-16 12:42:48
MySQL
Katya Smirnova, 2019-02-16 12:42:48

db table structure?

Let's say you have a freelance website. There are projects on it, the status of which can be: active, delivered, closed, confirmed. I think at the expense of organizing a table with projects. What is the best way to implement status storage? In one column with numbers from 1 to 4? Or 4 columns with boolean values ​​inside?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2019-02-16
@sireax

well, as I understand it, there are no intersections when the site is in two statuses, so in one column

B
bkosun, 2019-02-16
@bkosun

projects
id, status_id, name, ...

project_statuses
id, name, ...

Normal forms:
https://ru.wikipedia.org/wiki/%D0%9D%D0%BE%D1%80%D...
Database integrity:
https://ru.wikipedia.org/wiki/%D0 %A6%D0%B5%D0%BB%D...

E
Evgeny Petryaev, 2019-02-16
@Gremlin92

depends on how it stores (more precisely, how much memory is allocated to store 4 booleans>=<one integer.) On the other hand, there may be errors when more than one boolean state is in the pipeline, this will not happen with integers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question