cxone
cxone
全部文章
题解
归档
标签
去牛客网
登录
/
注册
cxone的博客
全部文章
/ 题解
(共8篇)
题解 | #浙江大学用户题目回答情况#两种join和子查询
-- join两种写法 以及子查询 方法1: select qpd.device_id, qpd.question_id, qpd.result from question_practice_detail as qpd inner join user_profile as up on up.devi...
Mysql
2022-01-03
47
1532
题解 | #查找GPA最高值#两种方法max和倒序第一条
COUNT(【Shift+8】):统计表中元组个数; 方法一 select max(gpa) gpa from user_profile WHERE university='复旦大学' 方法二 select gpa from user_profile WHERE university='复旦大学...
Mysql
2022-01-02
6
595
题解 | #查看学校名称中含北京的用户#字符匹配包含,个数,某个字符范围
select device_id,age,university from user_profile WHERE university like '%北京%' 匹配串中可包含如下四种通配符: _:匹配任意一个字符; %:匹配0个或多个字符; [ ]:匹配[ ]中的任意一个字符(若要比较的字符是连续的,...
Mysql
2022-01-02
17
906
题解 | #Where in 和Not in#多解 or in
--43ms SELECT device_id,gender,age,university,gpa from user_profile where university='北京大学' or university='复旦大学' or university='山东大学' --43ms SELECT de...
Mysql
2022-01-02
0
374
题解 | #查找除复旦大学的用户信息#多解
结果 -- 42s select device_id,gender,age,university from user_profile where university !='复旦大学' -- 45s select device_id,gender,age,university from user_...
Mysql
2022-01-02
0
449
题解 | #查找某个年龄段的用户信息#
select device_id,gender,age from user_profile where age>=20 and age<=23 select device_id,gender,age from user_profile age between 20 and 23
Mysql
2022-01-02
7
945
题解 | #查询结果限制返回行数#
select device_id from user_profile limit 0,2---运行效率更高 select device_id from user_profile limit 2 ---运行效率低 也可结合 limit offset: 一起使用时,limit表示要取的数量,offset...
Mysql
2022-01-02
1
300
题解 | #查询多列#
选择具体多列即可 select device_id,gender,age,university from user_profile drop table if exists user_profile; CREATE TABLE user_profile ( id int NOT NULL, dev...
Mysql
2022-01-02
0
946