當前位置:首頁 » 編程語言 » sql語句依據書名查詢書籍
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

sql語句依據書名查詢書籍

發布時間: 2022-05-01 15:50:42

A. 請用sql語句完成以下操作:查詢book表中書名為』計算機基礎』的圖書編號、作者。 要怎麼寫

select book_id, author from book where book_name ='計算機基礎'

能看懂么

B. 怎麼在sql查詢語句中查一類書中具體查一本書的價格,出版社

select 價格,出版社
from 圖書列表
where 書名='要查的書名'
and 類別=『要查的書的類別 』

C. mysql在[圖書明細]表中查詢"書名"中含有"入門"字眼的圖書信息,顯示所有列。

摘要 1、首先在mysql資料庫,創建一張data表,表內插入多條數據,用於測試。

D. 資料庫SQL語句實現下列問題

create proc t1
@dzno int,
@num int output
as
select @num=count(書號) from 借閱 where 讀者號=@dzno
return @num
go
create proc t2
@bookname varchar(50),
@author varchar(20)
as
select 出版社,單價 from 圖書 a where 書名 =@bookname and 作者=@author
go
create proc t3
@readername varchar(10),
@bookno int
as
declare @num int,@readerno int
select @readerno=讀者號 from 讀者 where 姓名=@readername
exec t1 @readerno,@num output

if @num>=(select 允許借閱冊數 from 讀者類別 a, 讀者 b where a.姓名=@readername and a.讀者類別編號=b.讀者類別編號)
begin
print '超出允許借閱冊數,不能再借了'
return
end
declare @days int
select @days=允許借閱天數 from 讀者類別 a, 讀者 b where a.姓名=@readername and a.讀者類別編號=b.讀者類別編號
print '借閱成功!'
insert into 借閱 values( @readerno,@bookno,getdate(),dateadd(dd,@days,getdate())

E. sql語句查詢(圖書借閱)

1,查詢所有借過書的學生編號,姓名,專業,?SELECT DISTINCT borrow.stuid, student.major
FROM borrow LEFT OUTER JOIN
student ON borrow.stuid = student.stuID2,借書但是未歸還的學生姓名及該生未歸還書的圖書數量?SELECT student.stuName, COUNT(1) AS Expr1
FROM borrow LEFT OUTER JOIN
student ON student.stuID = borrow.stuid
WHERE (borrow.b_time IS NULL)
GROUP BY student.stuName3,比如書名是《天龍八部》,請分別查詢借過它的人的姓名,借書日期,看了多少天,要考慮若某人借了但是沒還,則在看了多久一欄填上(尚未歸還)SELECT student.stuName, borrow.t_time, CASE WHEN borrow.b_time IS NULL THEN '尚未歸還' ELSE cast(datediff(day,t_time,b_time) as varchar) END AS Expr1
FROM borrow LEFT OUTER JOIN
student ON student.stuID = borrow.stuid LEFT OUTER JOIN
book ON borrow.bid = book.Bid
WHERE (book.title = '天龍八部')

F. sql中三個關系,學生、書籍和借,查詢借了某出版社出版的所有書的學生姓名,如何寫sql語句

---借了所有書籍的學生的學生姓名
select sname from student
where not exists(
select * from book
where not exists(
select * from stu_book
where sno=student.sno
and isbn=book.isbn
)
)

--借了某出版社出版的所有書的學生姓名
select sname from student
where not exists(
select * from book
where cbs='xxx出版社' and not exists(
select * from stu_book
where sno=student.sno
and isbn=book.isbn
)
)

G. SQL語句完成以下操作: 1、查詢所有書名包括「資料庫」的圖書記錄

select * from 表名 where 列名 like '%資料庫%'

H. 在SQL語句中要查詢book表中所有書名中以 計算機 開頭的書籍的價格,可用什麼語句

SELECT book.書名, book.價格
FROM book
WHERE (((book.書名) Like "計算機*"));

I. SQL 圖書管理系統的查詢語句

1. 求總藏書量、藏書總金額,總庫存冊數、最高價、最低價。
select count(圖書編號) as 總藏書量,
sum(定價) as 藏書總金額,
sum(實際數量) as 總庫存冊數,
max(定價) as 最高價,
min(定價) as 最低價
from 圖書卡片
go
2. 列出藏書在10本以上的書(書名、作者、出版社、年份)。
select 圖書名稱,作者姓名,出版社,出版日期
from 圖書卡片
group by 圖書編號 having(coung(1)>10)
order by 圖書名稱
go
3. 哪些出版社的藏書種類數超過100種。
select 出版社 as '藏書種類數超過100種的出版社'
from 圖書卡片
group by 出版社 having(count(類別)>100)
order by 出版社
go
4. 目前實際已借出多少冊書?
select sum(借出數量) as '借出數量'
from 圖書卡片
go
5. 年份最久遠的書。
select top 1 with ties 圖書名稱 from 圖書卡片
order by 出版日期
go
6. 「資料庫系統原理教程,王珊編,清華大學出版社,1998年出版」還有幾本?
select count(1) from 圖書卡片
where concaints(摘要,'"資料庫系統原理教程,王珊編,清華大學出版社,1998年出版"')
go
7. 哪一年的圖書最多?
select top 1 with ties convert(substring(出版日期,1,4)) as 年份,count(1) as '圖書數量'
from 圖書卡片
group by 出版日期
order by 圖書數量 desc
go
8. 哪本借書證未歸還的圖書最多?
select top 1 with ties A.讀者編號,count(1) as '借書數量'
from 圖書卡片 A,借閱 B
where A.圖書編號=B.圖書編號
group by A.讀者編號
order by 借書數量 desc
go
9、平均每本借書證的借書冊數。
select avg(借閱數量) as '平均每本借書證的借書冊數'
from 借閱
go

10.哪個系的同學平均借書冊數最多?
select top 1 with ties A.工作單位,avg(借閱數量) as '平均借閱數量'
from 讀者 A,借閱 B
where A.讀者編號=B.讀者編號
group by A.工作單位
order by 平均借閱數量' desc
go

11. 最近兩年都未被借過的書。
select 圖書名稱
from 圖書卡片
where 圖書編號 in(select 圖書編號 from 借閱 where datediff(year,借閱日期,getdate())>2)
go
12. 列出那些借了圖書逾期未歸還的借書證號和圖書名。
select A.讀者編號 as '借書證號',B.圖書名稱
from 讀者 as A inner join 圖書卡片 as B on A.圖書編號=B.圖書編號
where A.應歸還日期<getdate() and A.實際歸還日期 is null
go
13.今年未借過書的借書證。
select 讀者編號
from 讀者
where 讀者編號 not in(select 讀者編號
from 讀者
where datediff(year,借閱日期,getdate())=0)
go

14. 今年那種書出借最多?
select top 1 with ties A.類別,count(1) as '借出數量'
from 圖書卡片 A,借閱 B
where datediff(year,B.借閱日期,getdate())=0
group by A.類別
order by 借出數量' desc
go

J. 資料庫檢索SQL語句題目求 解答

1、select 圖書編號,書名,定價 from 圖書 where 出版社標號='CS';
2、select 圖書.書名,圖書.定價,出版社.出版社名稱 from 圖書,出版社 where 圖書分類='教材' and 圖書.出版社編號=出版社.出版社編號;
3、select 出版社編號,count(圖書編號),avg(定價) from 圖書 group by 出版社編號;
4、select 圖書.圖書編號,圖書.書名 from 圖書,出版社 where 圖書分類='教材' and 圖書.出版社編號=出版社.出版社編號 and 出版社.出版社編號=『高等教育出版社』 and 圖書.定價>30;