I have a database, trying to transfer it to hosting on MySQL. Created, say, two tables:
Table1 (ID1, Name1)
Table2 (ID2,ID1, Name2, Quantity)
ID1 (in Table 1) and ID2 are primary, and how to make ID2 refer to ID1? Something like this does not work:
ALTER TABLE Table2 FOREIGN KEY ID2 REFERENCES Table1 (ID1)
ALTER TABLE Table2 ADD FOREIGN KEY ID1 REFERENCES Table1 (ID1)
- alexlzALTER TABLE Table2 ADD FOREIGN KEY (ID1) REFERENCES Table1 (ID1);
- alexlz