首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
Dateron
获赞
109
粉丝
1
关注
3
看过 TA
5
男
天津商业大学
2017
数据挖掘
IP属地:广东
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑Dateron吗?
发布(71)
评论
刷题
收藏
Dateron
关注TA,不错过内容更新
关注
2021-06-06 16:31
天津商业大学 数据挖掘
题解 | #获取Employees中的first_name#
考察字符串截取函数left(str,len) 从左边截取,截取xx长度right(str,len) 从左边截取,截取xx长度substring(str,position,len) position:开始位置,len:长度 select first_name from employees order by right(first_name,2)
0
点赞
评论
收藏
分享
2021-06-06 16:26
天津商业大学 数据挖掘
2021.06.06 在牛客打卡7天!
0
点赞
评论
收藏
分享
2021-06-06 14:37
天津商业大学 数据挖掘
题解 | #将employees表的所有员工的last_name和first_name拼接起来作为Name#
考察 MYSQL 的 concat 函数,和 excel 的 concatenate 函数用法基本一致concat(col1,col2)需要注意的是中间加空格,是' ',而不是 select concat(last_name,' ',first_name) from employees
0
点赞
评论
收藏
分享
2021-06-06 14:31
天津商业大学 数据挖掘
题解 | #使用子查询的方式找出属于Action分类的所有电影对应的title,description#
分析清楚题目要求最后 select 出的字段为 title、description;where 条件为 name=Action;剩下的就是表连接的问题了 select d.title ,d.description from film d left join (select b.film_id ,a.category_id ,a.name from category a left join film_category b on a.category_id=b.category_id) c on d.film_id=c.film_id where c.name='Action'
0
点赞
评论
收藏
分享
2021-06-06 14:17
天津商业大学 数据挖掘
题解 | #使用join查询方式找出没有分类的电影id以及名称#
没有被分类,则最后多表连接后的结果里分类 id 或者 分类名称肯定为 null 1.左连接 category 和 film_category2.再左连接 film select c.film_id ,c.title from film c left join (select b.film_id ,a.category_id ,a.name from category a left join film_category b on a.category_id=b.category_id) d on c.film_id=d.film_id where name is null
0
点赞
评论
收藏
分享
2021-06-05 13:52
天津商业大学 数据挖掘
题解 | #将titles_test表名修改为titles_2017#
MYSQL 中修改表名的语法 alter table table_name rename to/as new_table_name本题答案 alter table titles_test rename to titles_2017
0
点赞
评论
收藏
分享
2021-06-05 13:47
天津商业大学 数据挖掘
题解 | #将id=5以及emp_no=10001的行数据替换成id=5以及emp_no=10005#
MYSQL 中 replace 函数 update table_name set 替换值所在的列=replace(替换值所在的列,被替换的值,替换后的值) where condition 本题目答案替换条件为 id=5具体替换什么,将 id=5 的 emp_no 由10001替换为10005 update titles_test set emp_no=replace(emp_no,10001,10005) where id=5
0
点赞
评论
收藏
分享
2021-06-05 13:34
天津商业大学 数据挖掘
题解 | #将所有to_date为9999-01-01的全部更新为NULL#
MYSQL 更新语法 update table_name set column_name=value1 ,column2_name=value2 where condition本题目答案需要注意的是,能更新为 null 的前提是,create table 是这一列没有 not null 的约束条件 update titles_test set to_date=null ,from_date='2001-01-01' where to_date='9999-01-01'
0
点赞
评论
收藏
分享
2021-06-05 13:24
天津商业大学 数据挖掘
题解 | #删除emp_no重复的记录,只保留最小的id对应的记录。#
删除行语法 delete from table_name where condition本题答案1.需要注意的点是,用 group by 的时候,select 后必须有分组字段,不然会报错;2.并且删除和查询无法同时进行,所以用 emp_no 分组聚合出 min(id) 后,外层还需要再套一层 select delete from titles_test where id not in (select a.min_id from (select emp_no ,min(id) as min_id from titles_test group by emp_no) a)
0
点赞
评论
收藏
分享
2021-06-05 13:00
天津商业大学 数据挖掘
题解 | #构造一个触发器audit_log#
在MySQL中,创建触发器语法如下:CREATE TRIGGER trigger_name trigger_time trigger_eventON tbl_name FOR EACH ROW trigger_stmt 其中:trigger_name:标识触发器名称,用户自行指定;trigger_time:标识触发时机,取值为 BEFORE 或 AFTER;trigger_event:标识触发事件,取值为 INSERT、UPDATE 或 DELETE;tbl_name:标识建立触发器的表名,即在哪张表上建立触发器;trigger_stmt:触发器程序体,可以是一句SQL语句,或者用 BEGIN...
0
点赞
评论
收藏
分享
2021-06-05 12:38
天津商业大学 数据挖掘
题解 | #在last_update后面新增加一列名字为create_date#
MYSQL 新增列语法 alter table table_name add column column_name date_type (not null) (default value)本题答案 alter table actor add column create_date datetime not null default '2020-01-01 00:00:00'
0
点赞
评论
收藏
分享
2021-06-05 12:26
天津商业大学 数据挖掘
题解 | #针对上面的salaries表emp_no字段创建索引idx_emp_no#
MYSQL 中使用强制索引的语法 select col from table_name force index(index_name) where condition 本题正确答案 select * from salaries force index(idx_emp_no) where emp_no=10005关于强制索引的一些解释 查询优化器是MySQL数据库服务器中的一个组件,它为SQL语句提供最佳的执行计划;查询优化器使用可用的统计信息来提出所有候选计划中成本最低的计划;例如,查询可能会请求价格在10到80之间的产品。如果统计数据显示80%的产品具有这些价格范围,那么它可能会认为全表...
0
点赞
评论
收藏
分享
2021-06-05 11:31
天津商业大学 数据挖掘
5道题起
2021.06.05 在牛客打卡6天!
0
点赞
评论
收藏
分享
2021-06-04 18:57
天津商业大学 数据挖掘
题解 | #对first_name创建唯一索引uniq_idx_firstname#
MYSQL 创建普通索引(仅加速查询)的方法 alter table 表名 add index 索引名(创建索引的字段)创建唯一索引(加速查询+列值唯一)的方法 alter table 表名 add unique 索引名(创建索引的字段)创建主键索引(加速查询 + 列值唯一 + 无Null值 + 表中只有一个)的方法 alter table 表名 add primary key 索引名(创建索引的字段)创建组合索引(多列值组成一个索引,专门用于组合搜索) alter table 表名 add index 索引名(col1,col2,col3)创建全文索引(对文本的内容进行分词,进行搜索) al...
0
点赞
评论
收藏
分享
2021-06-04 18:12
天津商业大学 数据挖掘
题解 | #创建一个actor_name表#
考察创建表的另外一种方法,复制其他表数据来创建create table if not exists 要创建表的表名 as (select 字段名 from 表名 where 条件) create table if not exists actor_name as (select first_name ,last_name from actor)
0
点赞
评论
收藏
分享
1
2
3
4
5
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务