更新 update<表名>set<列=值>where…
#修改 update(修改)info set sex=‘1’where code=‘p003
’单列 update info set sex=‘0’
nation='n004'birthday='1999-9-9'where code='p001' update car set price=price*0.9 where price>30 update car set price=price*0.95 where
(brand='b006'||brand=‘b005’)&&price>30 #查询 select*from表名 select 列名1,列名2… from表名 --投影 select*from表名where条件 --筛选 1.等值与不等值 精确查 select * from car where code='c001'; select * from car where code != 'c001'; select * from car where price > 30; --下面的都是范围 select * from car where price >=30 && price <=50; select * from car where price between 30 and 50 select * from car where brand='b002' ||
brand='b004' || brand='b006' select * from car where brand in
('b002','b004','b006')
between a and b a和b之间 select*from car select name,price from car select*from car where price>40 select*from car where price>=30&&price<=50 select*from car where price between30and50 select*from car where brand='b002'||
brand='b004'||brand='b006' select*from car where brand ni(b002,b004,b006) select*from car where brand not in(b002,b004,b006) 2.模糊查
select*from表名where 列名 like宝马%’ %任意的代替
select*from表名where 列名 like'5%' select*from表名where 列名 like'%型' select*from表名where 列名 like'_5% 3.排序* from表名where…order by列名[ASC/DESC]列名
[asc/desc]… select * from car order by price desc select * from car order by brand desc,price asc