不做造粪机器
不做造粪机器
全部文章
分类
归档
标签
去牛客网
登录
/
注册
不做造粪机器的博客
全部文章
(共95篇)
题解 | #删除emp_no重复的记录 易错题#
delete from titles_test where id not in ( select a.* from (select min(id) from titles_test group by emp_no) a ) 不能一边删一边查,需要再套一层
2024-07-22
1
147
题解 | #构造一个触发器audit_log 易错题#
create trigger audit_log after insert on employees_test for each row begin insert into audit values(new.id,new.name); end 参考高赞评论在MySQL中,创建触发器语法如下:...
2024-07-22
1
172
题解 | #在last_update后面新增加一列 易错#
alter table actor add( create_date datetime not null default '2020-10-01 00:00:00' ) 注意格式alter table [表名] add ( 列名,数据结构,数据限制,默认值)
2024-07-22
1
144
题解 | #强制索引 易错题#
select * from salaries force index (idx_emp_no) where emp_no=10005 注意格式强制索引可以提高索引速度 SELECT…… FROM …… FORCE INDEX(index_name) WHERE……
2024-07-22
1
158
题解 | #针对actor表创建视图 易错题#
create view actor_name_view (first_name_v,last_name_v) as select first_name,last_name from actor create view [视图] ([视图的列名])select ...
2024-07-22
1
162
题解 | #对first_name创建唯一索引 易错#
alter table actor add unique index uniq_idx_firstname (first_name); alter table actor add index idx_lastname (last_name) 参考 https://blog.nowcoder.net/...
2024-07-22
1
158
题解 | #创建一个actor_name表 易错#
# 第一种方法 create table if not exists actor_name( first_name varchar(45) not null, last_name varchar(45) not null ); insert into actor_name select first...
2024-07-22
1
148
题解 | #查找最晚入职员工的所有信息#
select * from employees where hire_date = (select max(hire_date) hire_date from employees) 考察子查询
2024-07-22
1
129
题解 | #批量插入数据,不使用replace操作 易错#
# 参考高赞回答 # mysql中常用的三种插入数据的语句: # insert into表示插入数据,数据库会检查主键,如果出现重复会报错; # replace into表示插入替换数据,需求表中有PrimaryKey, # 或者unique索引,如果数据库已经存在数据,...
2024-07-22
1
150
题解 | #批量插入数据 易错题#
insert INTO actor (actor_id,first_name,last_name,last_update) values (1,'PENELOPE','GUINESS','2006-02-15 12:34:33'), (2,'NICK','WAHLBERG','2006-02-15 ...
2024-07-21
1
131
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页