distal-attribute
distal-attribute
distal-attribute
distal-attribute

error 1064

speedking47 posted 4 years ago in Creating a connection
When I want to create foreign key I get this message:
You have an error in your SQL syntax;check the manual that corresponds to your Mysql server version for the syntax to use near ')ON UPDATE NO ACTION ON DELETE NO ACTION' AT LINE 2
What do I have to do?
ansgar posted 4 years ago
Post the full query please.
speedking47 posted 4 years ago
here is:
ADD CONSTRAINT 'Fk1milos' FOREIGN KEY ('gradid') REFERENCES 'gradovi' ()
ansgar posted 4 years ago
That's not the full query ...
speedking47 posted 4 years ago
Is this the right query:

CREATE TABLE `korisnici` (
`maticnibroj` INT(13) NOT NULL,
`ime` VARCHAR(40) NOT NULL,
`prezime` VARCHAR(40) NOT NULL,
`gradid` INT(10) NOT NULL,
PRIMARY KEY (`maticnibroj`),
CONSTRAINT `FK1_gradid` FOREIGN KEY (`gradid`) REFERENCES `gradovi` ()
)
and why it's possible to set foreign key with query but not automatically in the card foreign key?
ansgar posted 4 years ago
Yes that's the query I asked for - thanks. Looks like you did not select a column in the foreign table, right? If you do so the column should appear in the now empty parentheses.
speedking47 posted 4 years ago
that was the problem I see it now.. thanks

Please login to leave a reply, or register at first.