select xs_bookn,xs_name,xs_num from xs;
SHOW columns FROM xs;
select xs_bookn as cardo,xs_name as `name`,xs_num as cnt from xs where xs_object = "计算机科学与技术"
select xs_bookn,xs_name,(10-xs_num) as '还能借书数' from xs
select distinct isbm from jy;
select * from book LIMIT 3;
select xs_bookn,xs_name,xs_object from xs where xs_num>3;
select * from xs where UNIX_TIMESTAMP(xs_brdate) > UNIX_TIMESTAMP('1982-08-08')
select book_name,(book_price * 0.8) as '新价格' from book ;
select xs_bookn,xs_name from xs where xs_object = "计算机科学与技术" and xs_num < 5;
select book_isbn,book_name,book_body from book where book_chuban <> "人民邮电出版社";
select * from xs where unix_timestamp(xs_brdate) >unix_timestamp('1980-06-01') and unix_timestamp(xs_brdate) < unix_timestamp('1982-12-31')
select * from xs where unix_timestamp(xs_brdate) between unix_timestamp('1980-06-01') and unix_timestamp('1982-12-31')
select book_name,book_price,book_repertory,book_copy from book where book_price between 20 and 50 and book_repertory not between 2 and 5
select * from xs where xs_object in ('计算机','信息工程','英语','自动化');
select * from xs where xs_bookn not in ('10000001','10000002') and xs_num between 2 and 5;
select * from xs where xs_name like "王%";
select * from xs where xs_name like "_小_";
select * from xs where xs_name like "李宏%" || xs_name like "李小%" ;
select * from xs where xs_object = "";
select * from xs where xs_boject is null;
select * from xs order by xs_num desc;
select max(book_price)as '最高价格',book_name,book_price,book_chuban from book ;
select book_name,book_price,book_repertory from book
where book_chuban = "机械工业出版社" order by book_price desc , book_repertory asc;
select (round(sum(xs_num)/count(xs_name)))as '学生借书平均数',max(xs_num) as '最大借书量',min(xs_num) as '最小借书量'
from xs where xs_object = "计算机";
select sum(book_repertory) as '各出版社的库存数',book_chuban as '出版社' from book group by book_chuban;
select count(xs_name) as "各专业的人数",xs_object as '专业' from xs group by xs_object;
select sum(xs_num) as '各专业借书量',xs_object as '专业名' from xs group by xs_object DESC;
select count(isbm) as '借书数',isbm as '图书编码' from jy inner join book on jy.isbm = book.book_isbn group by isbm;
select count(*) as '人数',xs_sex as '性别',xs_object as '专业' from xs group by xs_object,xs_sex;
/*30 查询XS表中男生数大于等于2的专业名,学生人数*/
select count(*) as '人数',xs_object from xs where xs_sex = '男' group by xs_object
/* 31.查询XS表中男生数或女生数不少于2的专业名以及学生人数*/
/*32.查询从BOOK表中,按“出版社”分组,查询该出版社书的平均价格和总复本数,并按“总复本数”升序显示,平均价格小于50。*/
select book_chuban,book_name,book_body,book_price from book where book_name like '%WEB%';