1
I have 3 tables that are connected:
1ª tabela:
GRADE (grade de horários)
Campos: ID - GRADE - ESTADO - VALIDADE
2ª tabela:
BLOCOS (blocos de horários da grade)
Campos: ID - ID_GRADE - BLOCO - DIA_SEMANA - DURACAO
3ª Tabela:
COMERCIAIS
resumidamente estes campos: ID, ID_CLENTE, ID_GRADE, ID_BLOCO
I’m wearing a FK to connect the Ids to their respective references in the tables.
My doubt is: In the 3rd table can be see the foreign key ID_GRADE, who is also in the 2nd and I put her thinking about decreasing the load in the database, because if by chance I try to put the GRID table in ESTADO-> desativado, the system before will search if there are any records to be executed before changing its state to disabled.
I know I could do it using JOIN in the BLOCKS table, but I think I can save the ID_GRADE, I avoid using JOIN, since the COMMERCIAL table will have many records.
This my thinking is correct or I am creating fields atoa ?
Look to read about Modeling and Normal Shapes
– Motta