当前位置:网站首页>牛客网数据库SQL实战详细剖析(26-30)
牛客网数据库SQL实战详细剖析(26-30)
2022-04-23 14:48:00 【游戏编程】
SQL26 汇总各个部门当前员工的title类型的分配数目
select de.dept_no, d.dept_name, t.title, count(*)from departments as d right join dept_emp as de on de.dept_no=d.dept_noleft join titles as t on de.emp_no=t.emp_nogroup by de.dept_no,d.dept_name,t.titleorder by de.dept_no,t.title
解题思路: 重点理解各个部门下各个title类型的汇总。
①先以员工编号为联结条件联结titles表和dept_emp表,得到员工部门编号和员工对应的title类型,再以部门编号为联结条件联结departments表,得到部门名称,最后记得限定titles表和dept_emp表的时间为当前to_date ='9999-01-01'。
②汇总的是各个部门下各个title类型,所以要先将部门编号进行一次汇总,再将tltle类型进行汇总,聚合函数count的参数为title。
SQL29 使用join查询方式找出没有分类的电影id
select f.film_id, f.titlefrom film fleft join film_category fc on f.film_id = fc.film_id where fc.category_id is null
解题思路: 使用film表为主表,左联结film_category表,限定条件为分类id为空的记录。
SQL30 使用子查询的方式找出属于Action分类的所有电影对应的title,description
select fi.title, fi.description from film fi where fi.film_id in ( select f.film_id from film_category f where f.category_id = ( select category_id from category where name = 'Action' ) )
解题思路: 使用两次子查询(子查询内嵌套子查询),通过IN谓词,film_id,category_id,将三个表层层嵌套查询。
作者:酱饼
游戏编程 ️,一个游戏开发收藏夹~
如果图片长时间未显示,请使用Chrome内核浏览器。
版权声明
本文为[游戏编程]所创,转载请带上原文链接,感谢
https://www.233tw.com/database/118804
边栏推荐
- 如何打开Win10启动文件夹?
- 【工厂模式详解】工厂方法模式
- Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
- 8.2 文本预处理
- pnpm安装使用
- 外包幹了四年,廢了...
- 成都控制板设计提供_算是详细了_单片机程序头文件的定义、编写及引用介绍
- Chapter 7 of JVM series -- bytecode execution engine
- MCU function signal generator, output four kinds of waveforms, adjustable frequency, schematic diagram, simulation and C program
- Swift: entry of program, swift calls OC@_ silgen_ Name, OC calls swift, dynamic, string, substring
猜你喜欢
SVN详细使用教程
we引用My97DatePicker 实现时间插件使用
OC 转 Swift 条件编译、标记、宏、 Log、 版本检测、过期提示
Proteus simulation design of DC adjustable regulated power supply (with simulation + paper and other data)
Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
DVWA之暴力破解(Brute Force)Low-->high
Eight way responder system 51 Single Chip Microcomputer Design [with Proteus simulation, C program, schematic diagram, PCB files, component list and papers, etc.]
Sword finger offer II 019 Delete at most one character to get palindrome (simple)
外包幹了四年,廢了...
Matlab Simulink modeling and design of single-phase AC-AC frequency converter, with MATLAB simulation, PPT and papers
随机推荐
Realization of four data flow modes of grpc based on Multilingual Communication
Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
555 timer + 74 series chip to build eight way responder, 30s countdown, proteus simulation, etc
select 同时接收普通数据 和 带外数据
Bingbing learning notes: take you step by step to realize the sequence table
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
【Proteus仿真】自动量程(范围<10V)切换数字电压表
[NLP] HMM hidden Markov + Viterbi word segmentation
Sword finger offer II 019 Delete at most one character to get palindrome (simple)
Brute force of DVWA low -- > High
Explanation and example application of the principle of logistic regression in machine learning
【工厂模式详解】工厂方法模式
Alexnet model
go基础 反射
MySQL error packet out of order
Proteus simulation design of DC adjustable regulated power supply (with simulation + paper and other data)
如何打开Win10启动文件夹?
Matlab Simulink modeling and design of single-phase AC-AC frequency converter, with MATLAB simulation, PPT and papers
1 minute to understand the execution process and permanently master the for cycle (with for cycle cases)
全连接层的作用是什么?