我总共有 6 个表,但我正在尝试将外键添加到一个表(用户)以引用方表
我收到无法更新子行错误 1452 的错误
我对sql相当陌生。任何人都可以帮助我的空值错误吗?
grant all on election.* to 'user_id'@'localhost';
set password for 'user_id'@'localhost' =password('userpassword');
CREATE TABLE user
(
const_id INT (11) ,
username VARCHAR (25) NOT NULL,
passwd VARCHAR (25) NOT NULL,
const VARCHAR (40) NOT NULL,
PRIMARY KEY (const_id)
);
ALTER TABLE user ADD Foreign Key (passwd) references party (party_id);
宴会桌......
CREATE TABLE party
(
party_id VARCHAR (25) ,
member VARCHAR (20),
leader VARCHAR (20),
address VARCHAR (25),
PRIMARY KEY(party_id)
);