We practiced a database modeling with the starbucks beverages page as below.
First, We needed to list up the each information and look for the repeated ones.
And then we separated the information as a different table and drew a line which refers to the other table's information.
The result of mine is as below.
And following is the best example our mentor showed.
->We could see that the allergen and product(drinks) are many to many relation so have a junction table.
There were some more basic rules to make the tables look easier refering to the best example above.
Table name should be in lowercase and in a plural form.
column name should be in snake case (snake_case)
The name of a Foreign Key should be in a singular form of the name of the table it refers to, adding "_id"
For example, as you could see in the best example of the Starbucks modeling, if the Foreign Key refers to the "categories table", the name of the Foreign Key should be "category_id".
If we could notice the information from the table name, then we don't have to put it in the column name.
We should consider the expandability when we do database modeling.
For example, as you could see in the best example of the Starbucks modeling, we better make a separate table for "images" if we think that there will be more images added later.