martinhocosta Posted April 8, 2014 Report Share Posted April 8, 2014 estou a criar uma tabela com uma chave secundaria mas está a dar este erro, Mensagens do MySQL :#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'REFERENCES servico(id_servico))' at line 7 create table produtos_1 ( id_produto int not null primary key auto_increment, nome_produto varchar(30) not null, imagem blob not null, quantidade int , id_servico int not null, foreign key id_servico REFERENCES servico(id_servico)) obrigado :-S Link to comment Share on other sites More sharing options...
Knitter Posted April 9, 2014 Report Share Posted April 9, 2014 FOREIGN KEY (id_servico) REFERENCES servico(id_servico) http://dev.mysql.com/doc/refman/5.5/en/create-table-foreign-keys.html www.sergiolopes.eu Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now