mySQL之增删改查

insert into tbl(tname,tage) values(‘qaz’,18),(‘wsx’,20);
insert into tbl(tname,tage) select sname,sage from student

delete from tbl where 条件 and、or、>=、<=、条件

update tbl set tname=’qaz’ where tname=’wsx’

select tname as name,tage as age from tbl
select tname,tage,1 from tbl
mySQL之增删改查

select * from tble where id = 1
select * from tble where id!=1
select * from tble where id in(1,2,3)
select * from tble where id not in(1,2,3)
select * from tble where id in(select id from class)
select * from tble where id like ‘a%’
select * from tble where id like ‘a_’

select * from tble limit 100;限制每次查询显示100条数据
select * from tble limit 0,100;从第1条数据开始向后查询100条
select * from tble limit 100 offset 0;从第1条开始向后查询100条

select * from tble order by id desc limit 100;降序排列后取前100条
select * from tble order by id asc;升序排列