I'm creating a table with a foreign key but I get a syntax error:
drop table if exists enviada;
create table if not exists enviada
(
destinatario_email varchar(300),
destinatario_nome varchar(200),
destinatario_cpf_cnpj varchar(14),
data_envio datetime,
remetente varchar(50),
assunto varchar(200),
foreign key (assunto) references (email_html) assunto,
primary key (destinatario_email, destinatario_cpf_cnpj, data_envio, assunto)
);
sqlite> .read ".\\Scripts SQL\\esquema_email.sql"
Parse error near line 8: near "(": syntax error
o, assunto), foreign key (assunto) references (email_html) assunto );
error here ---^
What am I missing?
The syntax should be:
references email_html (assunto)