当前位置:网站首页>牛客网数据库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
边栏推荐
- Epolloneshot event of epoll -- instance program
- Design of single chip microcomputer Proteus for temperature and humidity monitoring and alarm system of SHT11 sensor (with simulation + paper + program, etc.)
- we引用My97DatePicker 实现时间插件使用
- QT actual combat: Yunxi chat room
- 你还不知道责任链模式的使用场景吗?
- [servlet] detailed explanation of servlet (use + principle)
- PCIe X1 插槽的主要用途是什么?
- First acquaintance with STL
- raised exception class EAccexxViolation with ‘Access violation at address 45EFD5 in module 出错
- How do I open the win10 startup folder?
猜你喜欢

Multisim Simulation Design of DC adjustable regulated power supply of LM317 (with simulation + paper + reference)

ASEMI三相整流桥和单相整流桥的详细对比

Electronic scale weighing system design, hx711 pressure sensor, 51 single chip microcomputer (proteus simulation, C program, schematic diagram, thesis and other complete data)

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

LM317的直流可调稳压电源Multisim仿真设计(附仿真+论文+参考资料)

Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot

交通灯系统51单片机设计(附Proteus仿真、C程序、原理图及PCB、论文等全套资料)

51 MCU flowers, farmland automatic irrigation system development, proteus simulation, schematic diagram and C code

8.2 文本预处理

一款不错的工具:aardio
随机推荐
一款不错的工具:aardio
AT89C52 MCU frequency meter (1Hz ~ 20MHz) design, LCD1602 display, including simulation, schematic diagram, PCB and code, etc
Detailed explanation of C language knowledge points -- first knowledge of C language [1]
Swift: entry of program, swift calls OC@_ silgen_ Name, OC calls swift, dynamic, string, substring
OC to swift conditional compilation, marking, macro, log, version detection, expiration prompt
Proteus simulation design of DC adjustable regulated power supply (with simulation + paper and other data)
Svn detailed use tutorial
《JVM系列》 第七章 -- 字节码执行引擎
2-Go变量操作
8.2 文本预处理
OpenFaaS实战之四:模板操作(template)
一个月把字节,腾讯,阿里都面了,写点面经总结……
Resolve the conflict between computed attribute and input blur event
Raised exception class eaccexviolation with 'access violation at address 45efd5 in module error
Unity_ Code mode add binding button click event
capacitance
Arduino for esp8266串口功能简介
1n5408-asemi rectifier diode
vscode中文插件不生效问题解决
Is asemi ultrafast recovery diode interchangeable with Schottky diode