mysql学习笔记(2)
2017-02-21 17:50
253 查看
单表查询
select column1,column2,... from 表名 [where condition]; #从查询结果中去掉重复行 select distinct column1,column2... from 表名 [where condition];
**
sql中特殊的比较运算符
**1.expr1 between expr2 and expr3; 2.expr1 in (expr2,expr3,...); 3.like 字符串匹配,用来进行模糊查询 4.is null #选出java_teacher>2并且student_id<2的记录 select * from student where 2 between java_teacher and student_id; #选出student_id等于2或4的所有记录 select * from student where student_id in(2,4); #模糊查询。sql有两个通配符:_ 和 % 。_代表任意一个字符,%代表任意多个字 #符。 select * from student where student_name like '孙_' and not student_id<5;
查询结果排序
# order by column1 [desc],column2... select * from student where student_id>2 order by java_teacher desc,student_name;
相关文章推荐
- MySQL学习笔记(十八)―― MySQL的命令集(8)
- MySQL学习笔记(三)
- MySQL学习笔记(六)扩展性设计之Memcached
- MySQL学习笔记(三)
- MySQL学习笔记(三)库的操作
- mysql学习笔记(2)
- Mysql学习笔记(七)查(补充)
- MySQL学习笔记——安装及配置环境
- 一千行MySQL学习笔记(四)
- MySql学习笔记_02_mysql的增删改查
- 一千行MySQL学习笔记
- MySQL学习笔记(一)
- 高性能MySql学习笔记1——锁、事务、隔离级别
- MySQL学习笔记
- mysql学习笔记
- MySQL学习笔记之左连接
- MySQL学习笔记——20170810
- MySQL学习笔记(六):MySQL中查看和修改表的存储引擎
- MySQL学习笔记(4)——创建、 查看数据表
- MySQL学习笔记