I have started learning MariaDB and have task to make 4 tables. I have created 3 tables easily, but now I have to create last table Uzsakymai. The table should contain the fields: Uzsakovo_kodas, Leidinio_kodas, Uzsakymo_periodas.
The first foreign key will connect Uzsakymai and Uzsakovai, the second key will connect the tables Uzsakymai and Periodiniai_lediniai
So I type like this:
CREATE TABLE Uzsakymai(
Uzsakovo_kodas INT(11),
Leidinio_kodas INT, Uzsakymo_periodas_menesiai int,
Primary key(Uzsakovo_kodas)
Foreign KEY(Uzsakovo_kodas) REFERENCES Uzsakymai(Uzsakovo_kodas));
But I am gotting syntax error. Could somebody telm what syntax erorro is here?
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PRIMARY KEY(Uzsakovo_kodas) FOREIGN KEY(Uzsakovo_kodas) References Uzsakovai(Uzs' at line 1