数据库学习知识点
2016-01-04 21:35
525 查看
查询语句基本结构
select + from + where + order by;
分类 投影操作 (select) 查询结果显示列
select 列名 from 表名 where 条件
* 指代查询显示所有
表前缀 select class.c_name form class8
列别名 select c_name as ‘姓名’ from class
字符拼接 select concat(c_name,’-‘,c_add) from stu;
排除重复数据 select distinct c_age from stu;
select distinct c_age,c_name from stu
## 组合查询排除重复
返回限定行数查询 select * from stu limit 0,3;
# 从第一行开始,查询3条数据
select * form stu limit 2
# 查询显示数据为 2 行
选择操作
排序操作 结果以什么顺序显示
select + from + where + order by;
分类 投影操作 (select) 查询结果显示列
select 列名 from 表名 where 条件
* 指代查询显示所有
表前缀 select class.c_name form class8
列别名 select c_name as ‘姓名’ from class
字符拼接 select concat(c_name,’-‘,c_add) from stu;
排除重复数据 select distinct c_age from stu;
select distinct c_age,c_name from stu
## 组合查询排除重复
返回限定行数查询 select * from stu limit 0,3;
# 从第一行开始,查询3条数据
select * form stu limit 2
# 查询显示数据为 2 行
选择操作
and where id=1 and name=‘张’ or where id=1 or id=3 between where year between 18 and 20 in (not in) where year in (18,19,20) like where iname=张%’ (模糊查询) 处理控制数据 is null (not null)
排序操作 结果以什么顺序显示
相关文章推荐
- 数据库第四章
- MongoDB-Manual-Master 读书笔记-CRUD操作
- SQL入门
- 保存数据到数据库
- ubuntu mysql 常用命令
- 关系型数据库管理系统简介
- 开发MySQL专业启动脚本—生产场景
- Mysql允许非本机登陆
- golang go-sql-drive mysql连接池的实现
- js中把数据库时间转为正常值
- redis 学习整理笔记
- mysql禁用validate_password插件
- SQL优化(四) PostgreSQL存储过程
- SQL优化(二) 快速计算Distinct Count
- linux下oracle设置开机自启动实现方法
- SQL优化(一) Merge Join VS. Hash Join VS. Nested Loop
- SQlite 使用笔记
- SQLite-常规用法
- SQL优化(三) PostgreSQL Table Partitioning
- iOS 数据库升级策略