【正文】
alter event eventJob on pletion preserve enable。 end還書(shū)時(shí)在return_table插入表項(xiàng):此時(shí)圖書(shū)歸還架上:(事件)eventJob,每天自動(dòng)觸發(fā)一次,掃描視圖stu_borrow,若發(fā)現(xiàn)當(dāng)前有預(yù)期歸還時(shí)間小于當(dāng)前時(shí)間,則判斷為超期,生成處罰記錄,這個(gè)定時(shí)器將每天定時(shí)觸發(fā)存儲(chǔ)過(guò)程proc_gen_ticket:sql:create event if not exists eventJobon schedule every 1 DAY /*每天觸發(fā)*/on pletion PRESERVEdo call proc_gen_ticket(getdate())。 end操作與結(jié)果顯示:mysql delimiter $$mysql create trigger trigger_borrow after insert on borrow for each row begin update book set book_num = book_num 1 where book_id = 。 設(shè)計(jì)觸發(fā)器 給出在各表上建立的觸發(fā)器以及使用的語(yǔ)句。操作和結(jié)果顯示:mysql create view cs_book as select * from book where in (select from book_sort where sort_id = 1)。操作和結(jié)果:mysql create view stu_borrow as select , , , , borrow_date,adddate(borrow_date,30) expect_return_date from student, book, borrow where = and = 。cs39。(cs)學(xué)生的視圖stu_cs:sql: create view stu_cs as select * from student where pro = ‘cs’。插入索引的操作和結(jié)果如下所示:mysql create index index_mid on manager(manager_id)。插入索引的操作和結(jié)果如下所示:mysql create index index_sid_bid on ticket(stu_id asc, book_id asc)。插入索引的操作和結(jié)果如下所示:mysql create index index_sid_bid_r on return_table(stu_id asc, book_id asc)。插入索引的操作和結(jié)果如下所示:mysql create index index_sid_bid on borrow(stu_id asc, book_id asc)。Query OK, 0 rows affectedRecords: 0 Duplicates: 0 Warnings: 0mysql create index index_brecord on book(book_record)。,以便方便查詢圖書(shū)的登記日期信息,升序:sql:create index index_brecord on book(book_record)。Query OK, 0 rows affectedRecords: 0 Duplicates: 0 Warnings: 0mysql alter table student add index index_name(stu_name desc)。,并且降序排序sql:alter table student add index index_name(stu_name, desc)。student:列名數(shù)據(jù)類型是否為空/性質(zhì)說(shuō)明stu_idintnot null /PK標(biāo)明學(xué)生唯一學(xué)號(hào)stu_namevarcharnot null學(xué)生姓名stu_sexvarcharnot null學(xué)生性別stu_ageintnot null學(xué)生年齡stu_provarcharnot null學(xué)生專業(yè)stu_gradevarcharnot null學(xué)生年級(jí)stu_integrityintnot null/default=1學(xué)生誠(chéng)信級(jí)book:列名數(shù)據(jù)類型是否為空/性質(zhì)說(shuō)明book_idintnot null / PK唯一書(shū)籍序號(hào)book_namevarcharnot null書(shū)籍名稱book_authorvarcharnot null書(shū)籍作者book_pubvarcharnot null書(shū)籍出版社book_numint not null 書(shū)籍是否在架上book_sortvarchar