比如说图书馆有图书book(id,name,prise....)
读者reader(id.....)
借阅关系 borrow( bookid,readerid,date)
显然存在一张表很不方便操作,分开又不方便查看
请建立个视图,view1: select * from book,reader,borrow where book.id=bookid and reader.id=readerid
请帮我写出...视图和语句(语句我写出来了)叩谢!!!!!!
读者reader(id.....)
借阅关系 borrow( bookid,readerid,date)
显然存在一张表很不方便操作,分开又不方便查看
请建立个视图,view1: select * from book,reader,borrow where book.id=bookid and reader.id=readerid
请帮我写出...视图和语句(语句我写出来了)叩谢!!!!!!
as
select *
from book,reader,borrow
where book.id=bookid and reader.id=readerid
--这个
CREATE OR REPLACE VIEW v_borrow AS SELECT * FROM book,reader,borrow WHERE book.id=
borrow.bookid
AND reader.id=readerid;
select * from book,reader,borrow where book.id=bookid and reader.id=readerid
select a.id as bookid,a.name as bookname,a.prise,
b.id as readerid,b.name as readername,c.date
from book a,reader b,borrow c
where a.id=b.bookid and b.id=c.readerid