1
My database has 6 tables:
--Movies table
MovieID int PK,
MovieName varchar(50)
MovieDescription text,
MovieCategory varchar(50),
MovieYear varchar(4),
ParticipationID)
--Series table
SeriesData (
SeriesID int PK,
SeriesName varchar(50),
SeriesDescription text,
SeriesCategory varchar(50),
SeriesYear varchar(4),
ParticipationId int FK);
--Actors Table
ActorsData (
ActorID int PK,
ActorName varchar(50),
ActorAge varchar(3),
ParticipationId int FK)
--Seasonsnepisodes Serves to answer the question "How many episodes do you have each season"
SeasonsEpisodes (
SerieID int PK,
SerieSeasons int,
SerieEpisodes int)
--Moviesparticipated This table is used to find out which films the actor participates in and which actors participate in a certain film
MoviesParticipated (
ParticipationId int PK
ActorID int FK
MovieID varchar(50) FK)
--Seriesparticipated This table serves to know in which films the actor participates and which actors participate in a certain film
SeriesParticipated (
ParticipationId int PK
ActorID int FK
SeriesID varchar(50) FK)
When I try to add records it gives me error because of the Foreign Keys. How I add records in tables?
That is, as all tables have Foreign Keys, I can not add records. There is a problem... I’ll edit the question to see if you can help me with something
– Diogo Teixeira
If there is a circular reference, you will need to review the modeling and remove one or more Fks (Ex: Tabela1 has FK pointing to table2, which has FK pointing to Tabela3, which has FK pointing to Tabela1) If it is not the case, you have to start by giving Insert in the table that does not depend on any other. Ex: Se
ItemPedido
depends onPedido
that depends onCliente
, has to first give Insert in theCliente
, afterwardPedido
, then onItemPedido
– Ronaldo Araújo Alves
I edited the answer :)
– Ronaldo Araújo Alves
So do I need to remove the FK Participationid? or take the 3?
– Diogo Teixeira
You can take out the 3. The table
MoviesParticipated
is dependent on these others, but should not be "dependent" on anyone.– Ronaldo Araújo Alves