Create Table Items
(i_num Integer Not Null Primary Key,
i_title Varchar (50) Not Null,
d_num Integer Not Null,
i_price Decimal (6,2) Not Null,
i_release_date Date Not Null,
i_genre Varchar (15) Not Null Check
(i_genre IN ('Jazz', 'Blues', 'Country', 'Rock', 'Alternative', 'Rap', 'Classical', 'Other')),
Foreign Key (d_num) References Distributors (d_num),
On Update Cascade
On Delete Cascade);
答案 0 :(得分:0)
Create Table Distributors (
d_num Integer Not null
);
Create Table Items(
i_num Integer Not Null Primary Key,
i_title Varchar(50) Not Null,
d_num Integer Not Null,
i_price Decimal(6,2) Not Null,
i_release_date Date Not Null,
i_genre Varchar(15) Not Null,
constraint FOREIGN KEY (d_num) REFERENCES Distributors(d_num) ON UPDATE CASCADE ON DELETE CASCADE,
Constraint ´genre_items_in´ Check (i_genre IN ('Jazz', 'Blues', 'Country', 'Rock', 'Alternative', 'Rap', 'Classical', 'Other'))
);
试试这个,在定义级联时,你在命令中使用了不必要的“,”符号。