空值查询 use Library select * from Borrow2 where ReturnDate is null 统计个数 use Library select COUNT(distinct Rno) from Reader2 求平均数 use Library select avg(Rage) from Reader2 升降序 use Library select * from Borrow2 order by Rno asc, BorrowDate desc 条件查询2 use Library select Rno from Borrow2 group by Rno having COUNT(distinct Bno) >=2 连接查询 use Library select Reader2.Rname,Book2.Btitle,Borrow2.BorrowDate Borrow2,Book2,Reader2 where Reader2.Rno = Borrow2.Rno and Borrow2.Bno = Book2.Bno 连接查询2 use Library select distinct Reader2.*,Borrow2.BorrowDate from Borrow2,Reader2 where Reader2.Rno = Borrow2.Rno 连接查询3 use Library select Reader2.Rno,Reader2.Rname from Borrow2,Reader2 条件查询3 use Library
from select Bno,Btitle,Bprice from Book2 where Bprice < (select Bprice from Book2 where Bno = 1) where Reader2.Rno = Borrow2.Rno and Borrow2.Bno = 2 除法查询 use Library select Rno,Rname from Reader2 c where not exists (select Bno from Borrow2 y where y.Rno = 1 and not exists (select * from Borrow2 x where x.Bno = y.Bno and c.Rno = x.Rno )) 模糊查询 use Library select * from Book2 where Btitle like '%数据库%' or Bprice <= 50