当前位置:网站首页>牛客网数据库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
边栏推荐
- Frame synchronization implementation
- QT interface optimization: QT border removal and form rounding
- Set up an AI team in the game world and start the super parametric multi-agent "chaos fight"
- 详解TCP的三次握手
- 8.5 循环神经网络简洁实现
- 3、 Gradient descent solution θ
- OpenFaaS实战之四:模板操作(template)
- 自动化的艺术
- 电容
- Resolve the conflict between computed attribute and input blur event
猜你喜欢

SVN详细使用教程

全连接层的作用是什么?

Explain TCP's three handshakes in detail
![[jz46 translate numbers into strings]](/img/e0/f32249d3d2e48110ed9ed9904367c6.png)
[jz46 translate numbers into strings]

we引用My97DatePicker 实现时间插件使用

I thought I could lie down and enter Huawei, but I was confused when I received JD / didi / iqiyi offers one after another

机器学习之逻辑回归(Logistic Regression)原理讲解和实例应用,果断收藏

一款不错的工具:aardio
![[NLP] HMM hidden Markov + Viterbi word segmentation](/img/9a/b39a166320c2f2001f10913f789c90.png)
[NLP] HMM hidden Markov + Viterbi word segmentation

Electronic perpetual calendar of DS1302_ 51 single chip microcomputer, month, day, week, hour, minute and second, lunar calendar and temperature, with alarm clock and complete set of data
随机推荐
Swift - literal, literal protocol, conversion between basic data types and dictionary / array
First acquaintance with STL
全连接层的作用是什么?
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
do(Local scope)、初始化器、内存冲突、Swift指针、inout、unsafepointer、unsafeBitCast、successor、
Contraction mapping theorem
Detailed explanation of C language knowledge points -- first knowledge of C language [1]
压缩映射定理
1-初识Go语言
Vous ne connaissez pas encore les scénarios d'utilisation du modèle de chaîne de responsabilité?
The initial C language framework is suitable for review and preliminary understanding
I/O复用的高级应用:同时处理 TCP 和 UDP 服务
Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)
Parameter stack pressing problem of C language in structure parameter transmission
51 MCU flowers, farmland automatic irrigation system development, proteus simulation, schematic diagram and C code
Swift protocol Association object resource name management multithreading GCD delay once
Raised exception class eaccexviolation with 'access violation at address 45efd5 in module error
I thought I could lie down and enter Huawei, but I was confused when I received JD / didi / iqiyi offers one after another
DVWA之暴力破解(Brute Force)Low-->high
Vscode Chinese plug-in doesn't work. Problem solving