Here is my SQL:
INSERT INTO film (film_id, title, description, release_year, language_id, original_language_id,
rental_duration, rental_rate, length, replacement_cost, rating, special_features, last_update)
VALUES ('1001','1 st Grade FBI Agent','An undercover FBI agent must pretend to be
a 1st grade teacher to catch the bad guy', '2014','2','null', '5', '4.99', '123', '2014',
'20.99', 'PG-13', 'Tailers');
Here is the error I get when I run it. This is a preset database I'm using for an assignment for a class, and I was told to insert a new row into the film table.
Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (sakila.film, CONSTRAINT fk_film_language_original FOREIGN KEY (original_language_id) REFERENCES language (language_id) ON UPDATE CASCADE)
'null', you probably meantnull(no single quotes)NULLasoriginal_language_id, which violate foreign key constraint. Or if you allow null on the column, you probably should write it asNULLinstead of'null'languagestable which does not exist or never did exist. This is a data problem most likely, rather than a problem with the design.