1,条件查询格式:(条件:where)
select * from 表名 where 条件;
2,比较条件查询:(条件运算符)
select * from 表名 where 条件1 条件运算符 条件2 ;
3,逻辑条件查询:(逻辑运算符)尽量使用英文
select * from 表名 where 条件1 逻辑运算符 条件2 ;
4,范围查询: between…and in(…)
select * from 表名 where 范围1 范围语句 范围2;
类似 ’或’ 的用法;
5,判断是否为null:
select * from 表名 where 字段 判断语句;
6,模糊查询: like
select * from 表名 where 字段名 like ‘ 通配符字符串 ’;
//例:
-- 模糊查询like
-- 查询姓马的学生: 第一个是马,后面无所谓
select * from student where name like '马%';
-- 查询姓名中包含'德'字的学生
select * from student where name like '%德%';
-- 查询姓马,且姓名有三个字的学生
select * from student where name like '马__';