当前位置: 首页 > news >正文

今天做的力扣SQL

我本地markdown的东西直接复制出来了。
多说一嘴,今天早上六点醒了,然后被外面吵,心里也担心找实习就一直睡不着了。索性直接来实验室,这一上午感觉好快啊。幸运的是,自己也没有浪费时间,还行吧。SQL欠的账迟早要还

181-employees-earning-more-than-their-managers

找出收入比经理高的员工

select a.name as 'Employee'
from employee as a, employee as b
where a.managerId = b.id and a.salary > b.salary

182-duplicate-emails

编写解决方案来报告所有重复的电子邮件。 请注意,可以保证电子邮件字段不为 NULL。

以 任意顺序 返回结果表。

查找重复的电子邮箱

select email
from Person
group by email
having count(email) > 1

183-customers-who-never-order

https://leetcode.com/problems/customers-who-never-order/description/
找出所有从不点任何东西的顾客。

从不订购的客户,2025年6月9日 星期一

select customers.name as 'Customers'
from customers
where Customers.id not in (select customerId from orders)-- left join
select customers.name as 'Customers'
from customers
left join orders on Customers.id = Orders.customerId
where Orders.customerId is null

184-department-highest-salary

查找出每个部门中薪资最高的员工。
按 任意顺序 返回结果表。
https://leetcode.com/problems/department-highest-salary/description/

部门工资最高的员工

select Department.name as 'Department',Employee.name as 'Employee',Employee.salary as 'Salary'
from Employee
left join Department on Employee.departmentId = Department.id
where (Department.id, salary) in (select departmentId, max(salary)from Employeegroup by departmentId)
http://www.xdnf.cn/news/959275.html

相关文章:

  • 二维FDTD算法仿真
  • C++ 类的定义与构造 / 析构函数解析
  • python3基础语法梳理(一)
  • 验证回文串
  • 【学习分享】shell脚本基础(全)
  • 深度解析云存储:概念、架构与应用实践
  • 外链域名年龄 vs 数量老域名的1个链接抵新域名的100个吗?
  • 【配置篇】告别硬编码:多环境配置、@ConfigurationProperties与配置中心初探
  • FDD损失函数 损失函数和梯度的关系
  • Day49 Python打卡训练营
  • 【前端】js Map集合的使用方法
  • C++11委托构造函数和继承构造函数:从入门到精通
  • 查询宝塔的数据库信息
  • 共享存储系统
  • 动画直播如何颠覆传统?解析足球篮球赛事的数据可视化革命
  • ONNX详解:跨平台模型部署解决方案
  • 【Java】谈谈HashMap
  • 2025.06.09【RNA-seq】|逆转录元件(retrotransposon)表达分析全流程详解
  • 运动控制--小车的启动和停止算法
  • 数据结构第5章:树和二叉树完全指南(自整理详细图文笔记)
  • 数据集转换xml2txt 、xml2json、json2coco
  • 重排和重绘是什么,怎么解决?
  • GruntJS-前端自动化任务运行器从入门到实战
  • CAR:推理长度自适应新框架,提升精度同时还降低推理token数!!
  • python爬虫之数据存储
  • LangChain 中的文档加载器(Loader)与文本切分器(Splitter)详解《一》
  • 视频监控厂商“以图搜图”能力比对(大华/海康)
  • Java数值运算常见陷阱与规避方法
  • 华为WLAN概述知识点及案例试题
  • day26/60