我有这个表:
Create table table1 (
id Int UNSIGNED NOT NULL,
name VARCHAR(255) NOT NULL,
Primary Key(id),
Unique Key `name` (`name`))
ENGINE = InnoDB;
Create table table2 (
id1 Int UNSIGNED NOT NULL,
id2 Int UNSIGNED NOT NULL,
Primary Key (id1,id2))
ENGINE = InnoDB;
Alter table table2 add Foreign Key (id1) references table1 (id)
on delete restrict on update restrict;
Alter table table2 add Foreign Key (id2) references table1 (id)
on delete restrict on update restrict;
我想问一下,是否有可能创建一种类型view
,其中包含table1
中提到的两个用户(来自)的名称table2
?谢谢你的帮助。