mysql语句
mysql语句
选择:select * from table where 范围
插入:insert into table1(field1,field2)values(value1,value2)
栗子:
insert into info(name,country,salary)
values('名字1','china',1200.0),
('名字2','china',1900.0),
('名字3','USA',12000.0),
('名字4','UK',2000);
删除:delete from table where 范围
更新:update table1 set field1=value1 where 范围
查找:select * from table1 where field1 like '%value1%'(模糊匹配查找)
栗子:查找name中某个人的信息
select * from table where name like '%海%'
排序:select * from table order by filed1,field2[desc]
栗子:select * from info order by name desc;
总数:select count(*) as totalcount from table(as 是重命名)
栗子:
select count(*) as totalCount from info # 查询表里面多少条记录
就和:select sum(field1) as sumvalue from table1
栗子:
select sum(salary) as sumSalary from info;
平均:select avg(field1)as avgvalue from table
最大:select max(field1) as maxvalue from table
最小:select min(filed 1)as minvalue from table
浙公网安备 33010602011771号