任何人都可以解释为什么以下内容对MySql不起作用(当前给出语法错误):
create table manager
(
employee_name varchar(20) not null,
manager_name varchar(20) not null,
primary key employee_name,
foreign key (manager_name) references manager
on delete cascade
)
另外,假设它确实有效,当关系管理器中的元组被删除时会发生什么?
答案 0 :(得分:5)
语法是,
create table manager
(
employee_name varchar(20) not null,
manager_name varchar(20) null,
CONSTRAINT tb_pk primary key (employee_name),
CONSTRAINT tb_fk foreign key (manager_name)
references manager (employee_name) on delete cascade
)
问题:假设它确实有效,当关系管理器中的元组被删除时会发生什么?
答案:所有子条目也将被删除。