create table bookBase (
bookId char(7) not null,
bookName varchar(20) null,
bookAuthor varchar(20) null,
bookBrief text null,
bookPrice float null,
constraint PK_BOOKBASE primary key (bookId)
)create table bookRecord (
bookId char(7) not null,
bookLendTime datetime null,
bookBackTime datetime null,
bookInsertTime datetime null,
bookRe text null,
constraint PK_BOOKRECORD primary key (bookId)
)create table bookState (
bookId char(7) not null,
bookNum int null,
bookState char(4) null,
bookIsLend char(4) null,
constraint PK_BOOKSTATE primary key (bookId)
)create table book_publish (
bookId char(7) not null,
publishId char(5) not null,
publishTime char(10) null,
constraint PK_BOOK_PUBLISH primary key (bookId, publishId)
)
问题:1,怎么有创建触发器,当要删除bookBase中的,bookId的记录时,其它表中的对应的bookId记录也删除?
2,当要更新bookBase中的,bookId的记录时,其它表中的对应的bookId记录也同时更新?
bookId char(7) not null,
bookName varchar(20) null,
bookAuthor varchar(20) null,
bookBrief text null,
bookPrice float null,
constraint PK_BOOKBASE primary key (bookId)
)create table bookRecord (
bookId char(7) not null,
bookLendTime datetime null,
bookBackTime datetime null,
bookInsertTime datetime null,
bookRe text null,
constraint PK_BOOKRECORD primary key (bookId)
)create table bookState (
bookId char(7) not null,
bookNum int null,
bookState char(4) null,
bookIsLend char(4) null,
constraint PK_BOOKSTATE primary key (bookId)
)create table book_publish (
bookId char(7) not null,
publishId char(5) not null,
publishTime char(10) null,
constraint PK_BOOK_PUBLISH primary key (bookId, publishId)
)
问题:1,怎么有创建触发器,当要删除bookBase中的,bookId的记录时,其它表中的对应的bookId记录也删除?
2,当要更新bookBase中的,bookId的记录时,其它表中的对应的bookId记录也同时更新?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货