SQL SERVER复习笔记(三)(二)

2014-11-24 16:29:10 · 作者: · 浏览: 2
一个或者多个字符;_表示一个字符;[]与括号内匹配,[^]与括号内容不匹配;
要显示通配符本身,[]括号将其括住
*/
--查找书名第二个字符是S的
select * from book1
where 书名 like '_s%'
--查找书名第一个字符不是q
select * from book1
where 书名 not like '_q%'
www.2cto.com
select * from book1
where 书名 like '_[^q]%'
--is null
select * from book1
where 出版社 is null
--between 和not between
select * from book1
where 定价 not between 0 and 66
--compute
select * from book1
where 出版社='中山大学'
compute avg(定价),SUM(定价)