GB279824
GB279824
全部文章
分类
归档
标签
去牛客网
登录
/
注册
GB279824的博客
全部文章
(共162篇)
题解 | 获取employees中的first_name
select first_name from employees order by substring(first_name,-2,2) ASC;
2025-05-25
0
17
题解 | 查找字符串中逗号出现的次数
select id,length(string)-length(replace(string,',','')) from strings; 用总的字符长度减去删除掉','符号的字符总长度得到的就是其中','符号的数量。
2025-05-25
0
17
题解 | 将所有获取奖金的员工当前的薪水增加10%
update salaries set salary = salary * 1.1 where to_date = '9999-01-01' and emp_no in( select emp_no from emp_bonus )
2025-05-25
0
16
题解 | 在audit表上创建外键约束,其emp_no对应employees_test表的主键id
alter table audit add foreign key(emp_no) references employees_test(id);
2025-05-25
0
16
题解 | 将titles_test表名修改为titles_2017
# alter table titles_test rename as titles_2017; rename table titles_test to titles_2017;
2025-05-25
0
15
题解 | 将id=5以及emp_no=10001的行数据替换成id=5以及emp_no=10005
replace into titles_test select 5, 10005,title,from_date,to_date from titles_test where id = 5;
2025-05-25
0
16
题解 | 将所有to_date为9999-01-01的全部更新为NULL
update titles_test set to_date = NULL,from_date = '2001-01-01' where to_date = '9999-01-01';
2025-05-25
0
15
题解 | 删除emp_no重复的记录,只保留最小的id对应的记录。
delete from titles_test where id not in( select min_id from( select min(id) as min_id from titles_test group by ...
2025-05-25
0
15
题解 | 在last_update后面新增加一列名字为create_date
# 插入一行内容用Insert into 表名 (‘列标签(可省略)’) VALUES(‘行内容’) # 插入一列 用 alter table 表名 add(‘列的属性’) alter table actor add column( create_date datetime not nu...
2025-05-24
0
16
题解 | 针对上面的salaries表emp_no字段创建索引idx_emp_no
select * from salaries FORCE INDEX(idx_emp_no) where emp_no = 10005 MYSQL中强制索引查询使用:FORCE INDEX(indexname);SQLite中强制索引查询使用:INDEXED BY indexname;
2025-05-23
0
16
首页
上一页
3
4
5
6
7
8
9
10
11
12
下一页
末页