//查询:
//条件查询:
select * from 表名 where 条件;
//例如:select * fom good where price > 20;
//and 和 or:
select 列名1,列名2,列名3 from 表名 where 条件1 and 条件2;
select 列名1,列名2,列名3 from 表名 where 条件1 or 条件2;
//例如:select name,price,quantity from good where price > 30 and quantity >20;
// select name,price,quantity from good where price > 30 or quantity >20;
//between and 和 in();
select 列名1,列名2,列名3 from 表名 where 列名 between 条件1 and 条件2;
select 列名1,列名2,列名3 from 表名 where 列名 in( , , , );
//例如:select name,price,quantity from good where price between 20 and 50;
// select name,price,quantity from good where price in(20,30,40,50);
//模糊查询:%代表任意个任意字符;_代表一个任意字符
select 列名 from 表名 where 列名 like ' %';
select 列名 from 表名 where 列名 like ' _';
//例如:select name from good where name like '毛%';
// select name from good where name like '毛_';
//null查询:
select 列名1,列名2 from 表名 where 列名 is (not) null;
//例如:select name,price from good where name is null;(where name is null);
// select name,price from good where name is not null;
//分页查询:limit限制返回结果的条数,offset确定第几条开始返回
select 列名1,... from 表名 limit n;(从第0条开始返回)
select 列名1,... from 表名 limit m,n;
select 列名1,... from 表名 limit m offset n;