简答题:mysql5.5常用的语句有哪些
答案:1 悬赏:0 手机版
解决时间 2021-11-09 14:12
- 提问者网友:嗝是迷路的屁
- 2021-11-08 20:04
简答题:mysql5.5常用的语句有哪些
最佳答案
- 五星知识达人网友:持酒劝斜阳
- 2021-11-08 21:24
1
选择:select * from table where 范围
2
插入:insert into table(field1,field2) values(value1,value2)
3
删除:delete from table where 范围
4
更新:update table set field1=value1 where 范围
5
查找:select * from table where field1 like ’%value1%’
6
排序:select * from table order by field1,field2 [desc]
7
总数:select count as totalcount from table
8
求和:select sum(field1) as sumvalue from table
9
平均:select avg(field1) as avgvalue from table
10
最大:select max(field1) as maxvalue from table
11
最小:select min(field1) as minvalue from table
12
例:
SELECt TOP 20 * FROM table
意思是:从table中查询前 20 项的全部内容
*可以用table中的内容表示
意思是:从table中查询前 20 项"某一项"的内容
SELECt SUM(grade) as total,average(grade) as average FROM table GROUP BY class
意思是:以班级为单位,查询这个班的总成绩和平均成绩
UPDATE table SET age=age+10
意思是:将 table 中所有人的年龄增加10岁
选择:select * from table where 范围
2
插入:insert into table(field1,field2) values(value1,value2)
3
删除:delete from table where 范围
4
更新:update table set field1=value1 where 范围
5
查找:select * from table where field1 like ’%value1%’
6
排序:select * from table order by field1,field2 [desc]
7
总数:select count as totalcount from table
8
求和:select sum(field1) as sumvalue from table
9
平均:select avg(field1) as avgvalue from table
10
最大:select max(field1) as maxvalue from table
11
最小:select min(field1) as minvalue from table
12
例:
SELECt TOP 20 * FROM table
意思是:从table中查询前 20 项的全部内容
*可以用table中的内容表示
意思是:从table中查询前 20 项"某一项"的内容
SELECt SUM(grade) as total,average(grade) as average FROM table GROUP BY class
意思是:以班级为单位,查询这个班的总成绩和平均成绩
UPDATE table SET age=age+10
意思是:将 table 中所有人的年龄增加10岁
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯