select name from emply where id >5;
先找表from emply
再找条件 where id >5
最后打印 你想打印的字段
可以把select看成打印
优先级为from->where-->select
先找到表,然后where一条条数据过滤,发现符合的就扔给select,select再梳理出自己需要的数据进行打印。
#where
select id,name,age from employee where id > 7;
select name,post,salary from employee where post='teacher' and salary > 8000;
select name,salary from employee where salary >= 20000 and salary <= 30000;
select name,salary from employee where salary between 20000 and 30000;
select name,salary from employee where salary < 20000 or salary > 30000;
select name,salary from employee where salary not between 20000 and 30000;
select * from employee where age = 73 or age = 81 or age = 28;
select * from employee where age in (73,81,28); 选一个
select * from employee where post_comment is Null; 不可以=Null 要用is去判断
select * from employee where post_comment is not Null;
select * from employee where name like "jin%"; %等于后面任意匹配(即任意长度任意字符)
select * from employee where name like "jin___";(_只匹配一个任意字符)