1. 程式人生 > >資料庫程式設計第二章課後作業

資料庫程式設計第二章課後作業

#第三題
SELECT bName,bid,author,pubComp,price 
FROM book WHERE bid NOT IN(
SELECT nif FROM boorrow)

#第四題
SELECT r.rName,b.bName,p.pData,p.amount FROM penalty p 
INNER JOIN reader r ON r.rid=p.rid
INNER JOIN book b ON b.bid = p.rid


#第五題
SELECT b.rid,b.willData,b.returnData,r.rName,k.bName FROM boorrow b 
INNER JOIN reader r ON r.rid=b.rid
INNER JOIN book k ON k.bid=b.nif
WHERE b.rid IN(SELECT rid FROM reader r WHERE r.rAddress IS NULL) 
ORDER BY b.willData DESC,b.rid DESC