Chapter3 MySQL的查操作汇总
一、基本查询语句
select * from tb1; #查询全部
select id,name from tb1; #查询局部
select id,name from tb1 where id>10 or name='xxx'; #条件查询
select id,name as cname from tb1 where id>10 or name='xxx'; #换表头显示
select name,age,11 from tb1; #多了一列,值全为11
二、进阶查询语句
1.大于、小于、不等于
select * from tb1 where id !=1;
select * from tb1 where id <>1; #不等于的另一种写法
2.选择、区间
select * from tb1 where id in (1,5,12);
select * from tb1 where id = 1