How should we design if there is more than one element in a single column?

Asked 2 years ago, Updated 2 years ago, 84 views

I'm worried about how to design the RDB column.How should I design it if there is a possibility of multiple elements in a single column?

For example, you want to design a table containing "watari," "wani," "sparrow," and "kamonohashi."At this time, you can store the following tables without any problems:

However, the platypus belongs to both mammals and reptiles because it lays eggs.
Therefore, the table looks like the following, but is there a better design?

Another design I've come up with is to create columns like "Mammals," "Reptiles," and "Fish," and manage them with Boolean variables. (Not very good)
I would appreciate your advice.

database database-design

2022-09-30 17:59

1 Answers

What kind of structure is good depends on what you want to express (what kind of use you want to use it for).

The "may contain more than one element in a column" state is called the non-regular system, and the operation to correct that state is called normalization.

If you simply want to normalize it, I think it would be like this:
Italics are the main key.

The procedures for normalization like this are frequently mentioned in the Information Processing Technician Examination, so you may want to refer to your commentary book/site.

They say that the platypus is an egg-laying mammal (not a reptile) (Wikipedia), so if you want to express "egg-laying or not", you may want to set up a different item instead of "like".


2022-09-30 17:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.