E
E
Evgenii Borovoi2020-12-09 11:15:01
SQL
Evgenii Borovoi, 2020-12-09 11:15:01

How to properly store data that may or may not be a separate table or nullable fields in a row?

There is an order. The client can select the "delivery" checkbox and then select the delivery city from the list and enter the address manually. In theory, you need to make a separate table with the order id, city id and address fields, right?
But in order not to fuss with unnecessary requests or joins, it’s easier for me to prescribe nullable fields in the order itself and not hover. Does this solution have obvious disadvantages? Does it break normalization?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
User700, 2020-12-09
@User700

If there is a boolean type field other than city and address, then it seems to formally degrade normalization. Also, this will indeed be the case when multiple orders / products, i.e. rows, it is possible to have one common delivery.

D
Denis, 2020-12-09
@sidni

In fact, this is how common tsms work in the past,
but still they duplicate data through the table because they save the address and then offer it for the next purchases to this user, as previously entered so as not to fill in again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question