今天练习的目标,新建collection_resource表,并新建trigger更新collection的资源数
专辑:mysql每天练习
新建collection_resource
1 | drop table if exists `collection_resource`; |
collection表添加资源数量字段
1 | alter table collection add column resource_count int(11) not null default 0 comment '资源总数'; |
新建trigger
1 | drop trigger if exists `insert_collection_resource`; |
运行
1 | insert into collection(name) values ('合集'); |
