I am creating a school system, I want together a list of linked teachers and materials Database (Mysql)

Asked

Viewed 57 times

-1

I am creating a school system, I want to add a list of teachers linked to materials and virse and versa. I use the Mysql database

Example:

Professor 1 - Materia 1
Professor 1 - Materia 2
Professor 1 - Materia 3
Professor 2 - Materia 1
Professor 2 - Materia 3

Where the same teacher can be related in more than one subject, and the same subject can be related in more than one teacher! Do you have any way to perform this procedure

  • What would be the structure of the bank and how you want this return?

1 answer

1


What you need is an n x n relationship, that is, many for many. This type of relationship between two tables requires a third table that will contain the foreign keys of the two tables in question. Ex:

Exemplo de relacionamento NxN

Browser other questions tagged

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