数据库(4)查询
来源:互联网 发布:最新机顶盒软件排行 编辑:程序博客网 时间:2024/06/05 13:23
基本语法
select * from 表名;
消除重复行
select distinct xxx from table;
条件
使用where子句对表中的数据筛选,结果为true的行会出现在结果集中
select * from 表名 where 条件;
比较运算符
等于=大于>大于等于>=小于<小于等于<=不等于!=或<>
查询编号大于3的学生
select * from students where id>3;
逻辑运算符
andornot
查询编号大于3的女同学
select * from students where id>3 and gender=0;
模糊查询
like%表示任意多个任意字符_表示一个任意字符
eg:
select * from students where sname like ‘黄%’ or sname like ‘%靖%’;
范围查询
1)不连续查询
select* from table where id in(1, 3, 8);
2)连续查询
select* from table where id between 1 and 9;
空判断
注意:null 与 ‘’是不同的
select * from table where xxx is null;
优先级
1)小括号,not,比较运算符,逻辑运算符
2)and比or先运算,
阅读全文
0 0
- 数据库(4)查询
- 数据库(数据查询)
- 数据库(查询)
- (三)数据库查询
- 数据库查询之(Ⅲ)连接查询
- (2)php数据库查询-查询
- 数据库之多表查询(连接查询)
- 数据库 --关联查询(多表查询)
- 数据库查询之(Ⅳ)子查询与合并查询
- 连接数据库查询(OpenRowSet)
- Delphi 数据库查询(TADOQuery)
- 数据库(多表查询)
- 数据库操作--查询(续)
- 数据库查询映射(MyBatis)
- 数据库查询操作(DQL)
- 数据库查询语句(exists)
- (笔记)数据库查询操作
- 数据库(关联查询 分组)
- XC7K325TFPGA+4路SFP+万兆光纤+USB3.0+SATA 3.0FMC载板
- .NET的Actor模型:Orleans Orleans是微软推出的类似Scala Akka的Actor模型,
- 悬浮隐藏效果
- 数据结构基础知识核心归纳(二)
- C语言基础复习——结构体(1)
- 数据库(4)查询
- Python科学计算--NumPy的数组对象ndarray
- 使用web服务器写一个登陆注册的界面
- vim文本编辑工具
- 二叉树
- #HTTP协议学习# (一)request 和response 解析
- XListView简单上拉加载下拉刷新
- OJ系统里用BufferedReader提高效率
- centos6搭建简易bind服务器