第四章トランザクション、ビュー、インデックス、バックアップ、リカバリ
1210 ワード
1,コードは“劉氷氷氷”が罰金を納めて図書の手続きを返還することを実現します
2,
3,
UPDATE book SET bCount=bCount-1
WHERE bName =" ";
UPDATE reader SET lendNum=lendNum+1
WHERE rName=" ";
INSERT INTO penalty VALUES('7','1',NOW(),'1','4.6');
UPDATE borrow SET returnDate=NOW(returnDate);
UPDATE reader SET lendNum=lendNum-1
WHERE rName=" ";
UPDATE book SET bCount=bCount+1
WHERE bName=" ";
2,
CREATE INDEX bName_index ON book(bName);
CREATE VIEW view_master
AS
SELECT (SELECT bName FROM book WHERE book.bid = borrow.nif)AS ' ',
willDate AS ' ',
(SELECT rName FROM reader WHERE reader.rid = borrow.rid) AS ' ',
returnDate AS ' '
FROM borrow WHERE willDate
3,
mysqldump -u root -p library > D:\library_20180807.sql
CREATE DATABASE libraryDB;
USE libraryDB;
source D:\library_20180807.sql;
SELECT * FROM reader INTO OUTFILE 'd:/doucter.txt';
SELECT * FROM book INTO OUTFILE 'd:/bisner.txt;'