牛客297995581号
牛客297995581号
全部文章
分类
题解(46)
归档
标签
去牛客网
登录
/
注册
牛客297995581号的博客
全部文章
(共48篇)
题解 | #分组计算练习题#
select gender, university, count(gender) user_num,//性别计数 avg(active_days_within_30) avg_active_days,//平均 avg(question_cnt) avg_question_cnt//平均 fr...
Mysql
2022-03-13
0
240
题解 | #计算男生人数以及平均GPA#
select count(gender) as male_num, round(avg(gpa),1) as avg_gpa from user_profile where gender = 'male'; 1.男性 2.计数:count() 3.平均:avg() 1.别名 2.round():...
Mysql
2022-03-13
0
224
题解 | #查询结果限制返回行数#
select device_id from user_profile limit 0,2; //limit x,y; x:起始记录的下标(第一题记录下标为0),y:共展示y条记录(包括下标为 x 的记录)
Mysql
2022-03-13
0
204
题解 | #查看学校名称中含北京的用户#
select gpa from user_profile where university = '复旦大学' order by gpa desc limit 0,1; //降序排列去第一名;limit 下标从0开始,取1条数据。
Mysql
2022-03-13
0
269
题解 | #查看学校名称中含北京的用户#
select round(max(gpa),1)//max() 求最大值。round(哪个值,小数点保留几位):四舍五入函数 from user_profile where university = '复旦大学';
Mysql
2022-03-13
10
286
题解 | #查找后多列排序#
select device_id,gpa,age from user_profile order by gpa asc,age asc; // order by gpa,age asc; 哪一列如何排,不指定如何排,默认升序 // order by gpa,age; 默认升序排列
Mysql
2022-03-13
7
626
题解 | #查找后排序#
select device_id,age from user_profile order by age asc; // order by + 列名 asc/desc:根据那一列升序/降序
Mysql
2022-03-13
9
810
题解 | #操作符混合运用#
select device_id,gender,age,university,gpa from user_profile where gpa > 3.5 AND university = '山东大学' union ...
Mysql
2022-03-11
12
1670
题解 | #操作符混合运用#
select device_id,gender,age,university,gpa from user_profile where (gpa > 3.5 AND university = '山东大学') or ...
Mysql
2022-03-11
0
197
题解 | #Where in 和Not in#
select device_id,gender,age,university,gpa from user_profile where university in ('北京大学','复旦大学','山东大学'); //in/not in + (集合中存放列值)
Mysql
2022-03-11
0
220
首页
上一页
1
2
3
4
5
下一页
末页