求助解答下面SQL查询语句
发布网友
发布时间:2023-11-02 04:12
我来回答
共2个回答
热心网友
时间:2024-05-04 15:53
第1个:select 读者姓名 from readers where 编号 in (
select 读者编号 from borrowinf
where 借期=to_date('20110506','yyyymmdd')
)
第2个:
select * from books where 书名 in
( select 书名 from books
group by 书名having count(*)>1
)
order by 书名,书号
第3个:
select 姓名 from readers where 编号 not in (
select 读者编号 from borrowinf)
第4个:select 编号,姓名 from readers
where 编号 in (
select 读者编号 from borrowinf,books
where borrowinf.图书编号=books.编号 and 出版社='教育出版社'
)
第5个:select 书价,书名 from books where 书价 in
(select min(书价)from books)
第6个:select * from books order by 书价
第7个:create view jyqx as
select a.编号,c.借期,b.借阅期限,c.还期,(c.借期+b.借阅期限) "应还日期" from books a,readers b,
borrowinf c
where a.编号=c.编号and c.读者编号=b.编号
第8个:select * from borrowinf b where b.还期<sysdate
第9个:select * from borrowinf where 读者编号='xxxxx'
第10个:create or replace procere jys_test(c_name varchar2) is
ast varchar2(500);
begin
ast := 'drop table test';
execute immediate ast;
ast := 'create table test as
select * from books where rownum < 0';
execute immediate ast;
ast:='
insert into test
select *
from books a
where a.图书编号 in
(select c.图书编号 from borrowinf c
where c.读者编号 in
(select b.读者编号 from readers b where b.读者姓名 = '''||c_name||'''))';
execute immediate ast;
end;
先写这么多,明天继续!
热心网友
时间:2024-05-04 15:53
select 姓名 from READERS where 借期 = '某天'
待续...追问我做好啦快 还差 最后5题 呵呵
追答update BOOKS set 定价 = 定价*0.9
insert into BOOKS ('','','',...) insert into READERS ('','','',...) 按字段顺序填值
update READERS set 借阅期限 = 借阅期限 + 10 where 读者类型 = '学生'
delete from BORROWINF where 还期 < getdate()
借阅最多读者
select top 1 R.* from (
select 读者编号,count(1) 借阅次数 from BORROWINF
group by 读者编号) A left join READERS R on A.读者编号 = R.读者编号
order by A.借阅次数 desc
借阅最少读者
select top 1 R.* from (
select 读者编号,count(1) 借阅次数 from BORROWINF
group by 读者编号) A left join READERS R on A.读者编号 = R.读者编号
order by A.借阅次数 asc