biubiubiu~~~~
biubiubiu~~~~
全部文章
题解
归档
标签
去牛客网
登录
/
注册
OldEleven的博客
OE出品,必属精品
全部文章
/ 题解
(共44篇)
题解 | #分页查询employees表,每5行一页,返回第2页的数据#
参考答案 # 方法一: select * from employees limit 5,5; # 方法二: select * from employees limit 5 offset 5;
Mysql
2021-11-05
0
252
题解 | #平均工资#
参考答案 #1. 查询到最大,最小salary的数据集 #2. 求出不在这个最大最小数据集的薪水的avg select avg(a.salary) avg_salary from salaries a where a.to_date='9999-01-01' and a.salary not i...
Mysql
2021-11-05
0
254
题解 | #按照dept_no进行汇总#
本题解析 考察GROUP_CONCAT()的使用 参考答案 select dept_no,GROUP_CONCAT(emp_no) as employees FROM dept_emp group by dept_no
Mysql
2021-11-05
0
201
题解 | #获取Employees中的first_name#
参考答案 从右边截取 select first_name from employees order by right(first_name,2) 知识拓展 从左边截取 截取id='10002'员工薪水的前4位作为他的新工资 update employees set salary=left(s...
Mysql
2021-11-05
0
308
题解 | #查找字符串 10,A,B 中逗号,出现的次数cnt#
本题解析 两个知识点: char_length() replace() 参考答案 select CHAR_LENGTH('10,A,B')-CHAR_LENGTH(REPLACE('10,A,B',',','')) 答案解析 CHAR_LENGTH('10,A,B') = 6 REPL...
Mysql
2021-11-05
0
277
题解 | #将所有获取奖金的员工当前的薪水增加10%#
本题解析 本题考察把查询当做条件更新部分表数据 参考答案 update salaries set salary = 1.1*salary where emp_no in (select emp_no from emp_bonus) and salaries.to_date='9999-01...
Mysql
2021-11-05
0
264
题解 | #删除emp_no重复的记录,只保留最小的id对应的记录。#
-本题解析 本题考查解读问题的思维逻辑和对同一张表查询的结果进行删除产生的问题解决能力 参考答案 DELETE FROM titles_test WHERE id NOT IN( SELECT * FROM( SELECT MIN(id) FROM titles_test GRO...
Mysql
2021-11-04
0
354
题解 | #在audit表上创建外键约束,其emp_no对应employees_test表的主键id#
-本题解析 考察外键的添加语法 参考答案 ALTER TABLE audit ADD FOREIGN KEY (EMP_no) REFERENCES employees_test (ID)
Mysql
2021-11-04
0
310
题解 | #构造一个触发器audit_log#
触发器 1.create trigger :创建触发器 2.触发器要说明是在after 还是before事务发生时触发 3.要指明是insert 、delete、update操作 4. on 表名 5.begin和end之间写触发的动作 6. new 关键字表示更新后的表的字段 ,old表示更新前的...
Mysql
2021-11-04
0
291
题解 | #在last_update后面新增加一列名字为create_date#
本题解析 考察指定位置添加表的列 参考答案 alter table actor add column create_date datetime NOT NULL default '2020-10-01 00:00:00' after last_update
Mysql
2021-11-04
0
283
首页
上一页
1
2
3
4
5
下一页
末页