I have a script in MySQL that creates two tables, the second table references a field in the first table, now when I try to run this script in one batch it returns an error. My guess is that it checks the referenced table in the second table definition before creating the tables.
Any idea how I can create both tables at once?
Thanks
Edit:
Example:
CREATE TABLE table1
(
ID INT NOT NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB;
CREATE TABLE table2
(
ID INT NOT NULL,
FID INT NOT NULL ,
PRIMARY KEY (ID),
FOREIGN KEY (FID) REFERENCES table1 (ID)
) ENGINE=InnoDB;
If I create the first table, then create the second table everything works fine, but when I run this in one batch it returns an error