The error is returned because you are sending the whole script together as one statement. It is compiled before it is executed. When the ALTER TABLE statement is compiled, the table has not been created yet.
Execute each statement separately. Also as commented before, you need one ALTER TABLE statement per foreign key.