So my table looks like this (from the "Show Create Table <table>"
query) :
CREATE TABLE stars_in_movies(
star_id int NOT NULL,
movie_id int NOT NULL,
KEY 'star_id' ('star_id'),
KEY 'movie_id' ('movie_id'),
CONSTRAINT 'stars_in_movies_ibfk_1' FOREIGN KEY('star_id') REFERENCES 'stars'('id'),
CONSTRAINT 'stars_in_movies_ibfk_2' FOREIGN KEY('movie_id') REFERENCES 'movies'('id'),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
And I am trying to simply enter a new entry into this table as so:
INSERT INTO stars_in_movies (907010, 834410);
And I get an Error as follows:
ERROR 1064 (4200): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to user near '907010, 834410)' at line 1
Now I know that this error is just simply a syntax error, but why am I receiving the error for such a simple INSERT query? Everywhere online suggest that this would be a valid statement, especially if the two entry fields are ACTUAL ids from the other two referenced tables.
EDIT:
Okay so for this trivial example I was simply missing the VALUES
keyword. To add onto the question, how come this query returns the same error?
INSERT INTO stars_in_movies
VALUES
(693109, m.id)
SELECT m.id
FROM movies m
WHERE m.title='Inception';