gogo668
gogo668
全部文章
分类
归档
标签
去牛客网
登录
/
注册
gogo668的博客
全部文章
(共63篇)
题解 | #按照dept_no进行汇总#
select dept_no,group_concat(emp_no order by emp_no) as employees from dept_emp group by dept_no group_concat用于不同行分组聚合连接,常与group by 一起使用;与concat的区别是,后者...
2024-10-23
0
55
题解 | #获取employees中的first_name#
select first_name from employees order by substring(first_name,-2); 根据题意,需要定位到字符串后两位字母,所以用substring函数
2024-10-23
0
48
题解 | #获取employees中的first_name#
select first_name from employees order by substring(first_name,-2); 根据题意,需要定位到字符串后两位字母,所以用substring函数
2024-10-23
0
51
题解 | #查找字符串中逗号出现的次数#
select id,length(string) - length(replace(string,',','')) as cnt from strings; 查找某列字符串中字符的个数,用length(string)函数
2024-10-22
0
47
将表中last_name和first_name通过'连接
select concat (last_name,'''',first_name) as name from employees
2024-10-22
0
59
题解 | #将所有获取奖金的员工当前的薪水增加10%#
update salaries set salary=salary*1.1 where to_date='9999-01-01' and emp_no in (select emp_no from emp_bonus) 更新部分列用update函数,基本语法是update 表 set 列=。。。 w...
2024-10-22
0
52
在audit表上创建外键约束
alter table audit add foreign key (emp_no) references employees_test (ID); 对于已经生成了父表和子表的情况,用alter table语句及add foreign key ...references进行外键创建。
2024-10-22
0
40
题解 | 将表名改为titles_2017
rename table titles_test to titles_2017; 在 MySQL 中,修改表名不是通过函数来实现的,而是使用 RENAME TABLE 语句来重命名一个已存在的表。
2024-10-22
1
38
将行数据replace成id=5以及emp_no=10005
replace into titles_test (id,emp_no,title,from_date,to_date) values(5, 10005, 'Senior Engineer', '1986-06-26', '9999-01-01'); replace into 表名(列名,。。。)v...
2024-10-21
1
58
to_date为9999-01-01的全部更新为NULL
UPDATE titles_test SET to_date = NULL, from_date = '2001-01-01' WHERE to_date = '9999-01-01'; 易混点:case是返回值,而update 是更新值操作。
2024-10-09
0
51
首页
上一页
1
2
3
4
5
6
7
下一页
末页