图书表
create table book
(
bookid VARCHAR2(30) not null,
category INTEGER, --图书类型
bookname VARCHAR2(30),
price VARCHAR2(20),
author VARCHAR2(30),
publish VARCHAR2(50),
uploadfilename VARCHAR2(200),
book_count INTEGER, --图书数量
storeid VARCHAR2(20),
constraint PK_BOOK primary key (bookid)
);
类型统计表
create table statistics
(
typeid INTEGER not null,
st_count VARCHAR2(500),
constraint PK_STATISTICS primary key (typeid)
);
创建一个什么样的触发器 能使当book表中的图书数量和类型更新时,自动更新statistics表中的内容。。求解
create table book
(
bookid VARCHAR2(30) not null,
category INTEGER, --图书类型
bookname VARCHAR2(30),
price VARCHAR2(20),
author VARCHAR2(30),
publish VARCHAR2(50),
uploadfilename VARCHAR2(200),
book_count INTEGER, --图书数量
storeid VARCHAR2(20),
constraint PK_BOOK primary key (bookid)
);
类型统计表
create table statistics
(
typeid INTEGER not null,
st_count VARCHAR2(500),
constraint PK_STATISTICS primary key (typeid)
);
创建一个什么样的触发器 能使当book表中的图书数量和类型更新时,自动更新statistics表中的内容。。求解
before insert or update or delete on book
for each row
declare
begin
if (inserting or deleting) then
--update statistics set... ;
end if;
if (updating and
(:new.category <> :old.category || :new.book_count <> :old.book_count)) then
--update statistics set... ;
end if;
end;