当前位置: 首页 > 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)

相关文章:

  • 基于FPGA的PID算法学习———实现P比例控制算法
  • 轻量级屏蔽文件管理方案
  • 深入浅出JavaScript中的ArrayBuffer:二进制数据的“瑞士军刀”
  • 端口扫描介绍及使用(学习笔记)
  • 苍穹外卖-day02
  • Profinet转CAN网关如何实现profinet与can协议互转
  • C++中auto和auto
  • 即梦图片 3.0 智能参考全量上线,开启 AI 设计零门槛新时代
  • 在 Windows 11 上创建新本地用户账户
  • 三元组 题解
  • 【Dv3Admin】系统视图登录日志API文件解析
  • qt 双缓冲案例对比
  • Vue 自动导入函数和变量插件 unplugin-auto-import
  • Vue动态/异步组件
  • Vue3中的computer和watch
  • tauri项目,如何在rust端读取电脑环境变量
  • 背包问题双雄:01 背包与完全背包详解(Java 实现)
  • React hook之useRef
  • 什么是Java bean的依赖注入
  • Vue3 PC端 UI组件库我更推荐Naive UI
  • 美工培训班培训学费/自建站seo如何做
  • 网站网格设计/电商平台哪个最好最可靠
  • 购物网站app制作/今天发生的重大新闻
  • 网站建设方案编写人/站长工具站长之家官网
  • 快速建手机网站/超级外链工具源码
  • 微商系统软件开发/志鸿优化网官网