首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
fejxc
获赞
29
粉丝
0
关注
5
看过 TA
1
井冈山大学
2022
Java
IP属地:未知
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑fejxc吗?
发布(50)
评论
刷题
收藏
fejxc
关注TA,不错过内容更新
关注
2021-09-23 17:08
井冈山大学 Java
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
# 需要注意的是set后面的内容用逗号隔开,而不是and update titles_test tt set tt.to_date=null,tt.from_date='2001-01-01' where tt.to_date='9999-01-01'
0
点赞
评论
收藏
分享
2021-09-23 16:54
井冈山大学 Java
题解 | #删除emp_no重复的记录,只保留最小的id对应的记录。#
# mysql不允许在查询的同时删除原表数据,如果向删除,必须给原始数据表取一个别名再删除, # 查询出结果,给结果取别名之后再删除 # 思路很简单,先用emp_no分组之后,找到最小的得ID delete from titles_test where id not in( select * from (select min(id) from titles_test t2 group by t2.emp_no ) t3)
0
点赞
评论
收藏
分享
2021-09-23 16:41
井冈山大学 Java
题解 | #构造一个触发器audit_log#
# 初识触发器 # 语言运行环境:Sql(mysql 8.0) # 1.创建触发器:create trigger 触发器名称 # 2.用after指定触发条件:在表1中每插入一行 after insert on 表1 for each row # (注意insert后用on,for each row不能少否则会报错) # 3.触发的指令写在begin和end之间,分号写在指令后,end后不用加分号 create trigger audit_log after insert on employees_test for each row begin -- insert into audit v...
0
点赞
评论
收藏
分享
2021-09-23 16:29
井冈山大学 Java
题解 | #在last_update后面新增加一列名字为create_date#
插入一行内容用Insert into 表名 (‘列标签(可省略)’) VALUES(‘行内容’)插入一列 用 alter table 表名 add(‘列的属性’) alter TABLE actor add column create_date datetime not null DEFAULT '2020-10-01 00:00:00' after last_update
0
点赞
评论
收藏
分享
2021-09-23 16:21
井冈山大学 Java
题解 | #针对上面的salaries表emp_no字段创建索引idx_emp_no#
-- create index idx_emp_no on salaries(emp_no); -- 【整体思路】两条语句:添加索引;查询时使用强制索引 force index -- 这里题目默认已经创建了索引,所以只需要提交一条语句。 -- 【易错点】force index要紧跟from后面,写在where语句之前,否则会报错。 -- 强制索引:FORCE INDEX(<索引名>); select * from salaries force index(idx_emp_no) where emp_no='10005';
0
点赞
评论
收藏
分享
2021-09-23 16:12
井冈山大学 Java
题解 | #针对actor表创建视图actor_name_view#
创建视图create view xxx as ....create view xxx(列名,列名...) as .... create view actor_name_view(first_name_v,last_name_v) as select a.first_name,a.last_name from actor a;
0
点赞
评论
收藏
分享
2021-09-23 15:41
井冈山大学 Java
题解 | #对first_name创建唯一索引uniq_idx_firstname#
MYSQL创建索引的两种方法 create [unique]index 索引名 on 表名(列名); alter table 表名 add [unique]index 索引名(列名);alter table actor add unique index uniq_idx_firstname(first_name); alter table actor add index idx_lastname(last_name); ```
0
点赞
评论
收藏
分享
2021-09-23 15:31
井冈山大学 Java
题解 | #创建一个actor_name表#
创建表的3中方法:1.create table xxx2.create xxx(目标表) like xxx(数据源表)3.create talbe xxx (.....)insert into xxx(目标表) select ... from xxx(数据源表)我用的是第三种方法 CREATE TABLE actor_name( first_name varchar(45) not null comment '名字', last_name varchar(45) not null comment '姓氏' ); insert into actor_name select a....
0
点赞
评论
收藏
分享
2021-09-23 15:16
井冈山大学 Java
题解 | #批量插入数据,不使用replace操作#
insert into (会见检查主键是否存在)replace into (要求表要有主键或者唯一索引)insert ignore into (忽视主键重复) insert ignore into actor values('3','ED','CHASE','2006-02-15 12:34:33')
0
点赞
评论
收藏
分享
2021-09-23 15:09
井冈山大学 Java
题解 | #批量插入数据#
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 12:34:33')
0
点赞
评论
收藏
分享
2021-09-23 15:06
井冈山大学 Java
题解 | #创建一个actor表,包含如下列信息#
create table if not exists `actor`( actor_id smallint(5) primary key COMMENT '主键id', first_name varchar(45) not null COMMENT '名字', last_name varchar(45) not null COMMENT '姓氏', last_update date not null COMMENT '日期' )engine=innodb default charset=utf8;
0
点赞
评论
收藏
分享
2021-09-23 14:47
井冈山大学 Java
题解 | #使用子查询的方式找出属于Action分类的所有电影对应的title,description#
子查询,可以用in或者exists select f.title,f.description from film f where f.film_id in(select fc.film_id from category c,film_category fc where fc.category_id=c.category_id and c.name='Action')
0
点赞
评论
收藏
分享
2021-09-21 11:44
井冈山大学 Java
题解 | #使用join查询方式找出没有分类的电影id以及名称#
select f.film_id , f.title from film f left join film_category fc on f.film_id=fc.film_id where fc.category_id is NULL
0
点赞
评论
收藏
分享
2021-09-20 23:22
井冈山大学 Java
题解 | #查找描述信息中包含robot的电影对应的分类名称以及电影数目,而且还需要该分类对应电影数量>=5部#
应该先找到每个电影分类下电影总数量大于5的category_id select c.name, count(fc.film_id) from film f,category c,film_category fc where f.description like '%robot%' and f.film_id=fc.film_id and fc.category_id=c.category_id and c.category_id in (select category_id from film_category ...
0
点赞
评论
收藏
分享
2021-09-20 23:03
井冈山大学 Java
练习sql
2021-09-20
在牛客打卡2天,今天学习:刷题 21 道/代码提交 56 次/学习课程 1 节
每日监督打卡
0
点赞
评论
收藏
分享
1
2
3
4
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客企业服务