--条件查询: select 列名列表 from 表名 where 条件
--where 条件:用来筛选满足条件的记录(行)
--条件有6种形式:
--1.比较大小:列名 比较运算符 值
--查询图书价格超过30元的图书信息
select * from Book where price>30
--查询清华大学出版社出版的图书信息
select * from Book where publish='清华大学出版社'
--查询2005-1-20日借书的图书编号
select * from borrow where borrowdate='2005-1-20'
--2.范围查询,
--查询在1976年出生的读者信息
select * from reader
where birthdate between '1976-1-1' and '1977-1-1'
--3.符合条件用and,or连接各条件
--查询各图书价格不再20-40之间的图书信息
select * from book where price not between 20 and 40
--集合查询: 列名【not】 in (值列表)
--查询图书价格是20,30,40,的图书信息
--查询清华大学,同济大学出版社出版的图书信息
select * from book where price=20 or price=30 or price=40
select * from book where price in (20,30,40)
select * from book where publish='清华大学出版社' or publish='同济大学出版社'
select * from book where publish not in('清华大学出版社','同济大学出版社')
--where 条件:用来筛选满足条件的记录(行)
--条件有6种形式:
--1.比较大小:列名 比较运算符 值
--查询图书价格超过30元的图书信息
select * from Book where price>30
--查询清华大学出版社出版的图书信息
select * from Book where publish='清华大学出版社'
--查询2005-1-20日借书的图书编号
select * from borrow where borrowdate='2005-1-20'
--2.范围查询,
--查询在1976年出生的读者信息
select * from reader
where birthdate between '1976-1-1' and '1977-1-1'
--3.符合条件用and,or连接各条件
--查询各图书价格不再20-40之间的图书信息
select * from book where price not between 20 and 40
--集合查询: 列名【not】 in (值列表)
--查询图书价格是20,30,40,的图书信息
--查询清华大学,同济大学出版社出版的图书信息
select * from book where price=20 or price=30 or price=40
select * from book where price in (20,30,40)
select * from book where publish='清华大学出版社' or publish='同济大学出版社'
select * from book where publish not in('清华大学出版社','同济大学出版社')

被折叠的 条评论
为什么被折叠?



