数据库的问题求解答

2025-01-07 00:00:11
推荐回答(3个)
回答1:

6 输入语句,在“图书表”中查询2008年出版的图书信息。
方法一:
select *from book
where pubdate between '2008-01-01' and '2008-12-31'
方法二:
select *from book
where year(pubdate)= 2008

7.
select distinct reader.rno,reader.rname from reader left join dbo.borrow on reader.rno=borrow.rno
left join dbo.book on borrow.bno=book.bno
where book.bname not in ('数据库原理') or book.bname is null

8.

alter table dbo.reader
add constraint un_rname unique (rname)

9.CREATEVIEW VIEW1 AS SELECT RNO,COUNT(RNO) AS 借阅次数 FROM BORROW
10.SELECT RNO FORM VIEW1 WHERE 借阅次数 IN (SELECT MAX(借阅次数) FROM VIEW1)
11.CREATE PROC BOOKPROC
@出版社 VARCHAR(20)
AS
DECLARE @图书编号 CHAR(6),@图书名称 VARCHAR(10),@出版时间 DATETIME
SELECT @图书编号=BNO,@图书名称=BNAME,@出版时间=出版日期
FROM BOOKS WHERE 出版社=@出版社
PRINT @图书编号,@图书名称,@出版时间

EXEC BOOKPROC '出版社A'

回答2:

6. select *
from dbo.book
where pubdate=2008
into T2-8.sql

7. select rno,rname
from dbo.reader,dbo.borrow,dbo.book
where dbo.reader.rno=dbo.borrow.rno
and dbo.borrow.bno=dbo.book.bno
and bname not like '%数据库原理%'

回答3:

oracle环境还是sqlserver环境?