Why create a table in Mysql?

Asked

Viewed 81 times

3

I’m learning to work with Mysql and I’m seeing some examples of how to work with more than one table, as an example below:

Id      Nome        Faculdade_id
101     Amanda      11
102     Bianca      12
103     Carla       13
104     Daniela     12
105     Edna        11

id      Faculdade   Estado
11      UERJ        RJ
12      UESP        SP
13      UNEB        BA

The goal of the example is to learn how to use more than one table, but it hit a doubt, in practice what is the advantage of creating two tables instead of simply creating other columns?

In the example I put I imagine that there is no more advantage if the tables are several columns and hundreds of rows, it would really be faster to use two tables instead of including more columns?

1 answer

1


When creating a second table you can share information, imagine that you have all the data pertaining to one person, about 20 metadata for example and one of those metadata refers to the faculty that that person attended, Keeping all college information in the people table is not semantically correct and causes the database to bring more information if no filter is applied. If there are 15 metadata referring to college the table of people can get very large and it will get harder work with her.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.