我希望你们能帮帮我。下面是我正在尝试执行的一些SQL代码。
create table Personne (
id_personne serial primary key,
nom text not null,
prenom text not null,
email text not null);
create table Ressource (
id_ressource serial primary key,
nom_r text not null,
url text not null,
id_personne int not null, foreign key references Personne(id_personne));我得到一个类似于“语法错误附近的‘参考人员(Id_personne))’行5的错误。
我不知道它是从哪里来的。我去了W3school.com,据我所知,我写的是正确的。但它就是不起作用。
任何形式的帮助都将不胜感激!
PS :我在MySql和Postgresql上试过,结果是一样的。
发布于 2018-02-28 03:52:14
您忘了输入列名
create table Ressource (
id_ressource serial primary key,
nom_r text not null,
url text not null,
id_personne int not null,
foreign key(id_personne) references Personne(primary_key_from_personne));
^^^^^^^^^^^^^^^^
(you missed it)https://stackoverflow.com/questions/49016803
复制相似问题