sql模糊查询
来源:互联网 发布:淘宝q币充错了 编辑:程序博客网 时间:2024/05/16 23:47
use pubs
--返回au_lname是以r开头的作者信息
select * from authors
where au_lname like 'r%'
--au_lname的最后一个字母是'n',第一个字母是'M'
--并且au_fname的最后一个字母是'r'
select * from authors
where au_lname like 'm%n' and au_fname like '%r'
--au_lname的第三个字母是e ,au_fname倒数第二个字母是o
select * from authors
where au_lname like '__e%' and au_fname like '%o_'
--au_lname只有四个字母
select * from authors
where au_lname like '____'
--au_lname的最后一个字符是a,b,c,d,e中的任意一个
select * from authors
where au_lname like '%[abcde]'
select * from authors
where au_lname like '%[a,b,c,d,e]'
select * from authors
where au_lname like '%[a-e]'
--address的最后三个字母是数字
select * from authors
where address like '%[0-9][0-9][0-9]'
--address的最后两个字母不是数字
select * from authors
where address like '%[^0-9][^0-9]'
--au_lname的第二个字母不是a,b,c,d,e,f中的任意一个
select * from authors
where au_lname like '_[^a-f]%'
--title的首字母是t,c,b中的任意一个,最后一个字母是s
--notes的最后一个字母不能是n
select * from titles
where title like '[t,c,b]%s' and notes like '%[^n]'
use pubs
--title包含the书籍
select * from titles
where title like '%the%'
--au_lname的第二个字母是"%"
--接在转义符号后面的通配符,会失去通配符的意义
select * from authors
where au_lname like '_a%%' escape 'a'
--查找au_lname是以”[x”开头,以”]”结尾,
select * from authors
where au_lname like 't[x%t]' escape 't'
--对返回的结果排序
select * from authors
order by au_lname desc
select * from titles
order by type desc,price asc
- SQL模糊查询
- SQL模糊查询
- 有关SQL模糊查询
- 有关SQL模糊查询
- sql 模糊查询
- SQL模糊查询
- SQL字符串模糊查询
- 模糊查询SQL语句
- SQL的模糊查询
- 有关SQL模糊查询
- 有关SQL模糊查询
- SQL模糊查询
- SQL模糊查询
- sql日期模糊查询
- SQL模糊查询
- SQL模糊查询
- sql模糊查询总结
- SQL模糊查询
- poj 2488 A Knight's Journey 简单dfs回溯 字典序
- Jsoup解析因特网址与浏览器查看内容不一致
- java反射小例子
- 添加右键快捷键
- POJ 3321 Apple Tree
- sql模糊查询
- 进制间转换
- MAC 快捷键
- 运算符
- 分支结构、循环结构
- 函数
- 数组、结构体、字符串
- 函数、数组练习
- 指针概念;数组指针、字符串指针、结构体指针、动态内存申请、指针数组;