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

d2025328

一、sql-判断三角形

610. 判断三角形 - 力扣(LeetCode)

用一下if加上判断条件

select x,y,z,if(x+y > z and x+z > y and y+z > x
and x-y < z and x-z < y and y-z < x,'Yes','No') as 'triangle'
from Triangle

二、按照分类统计薪水

1907. 按分类统计薪水 - 力扣(LeetCode)

if判断加count 统计+union

select 'Low Salary' as 'category',count(if(income < 20000,1,null)) as 'accounts_count' from Accounts
union
select 'Average Salary' as 'category',count(if(income >= 20000 and income <= 50000,1,null)) as 'accounts_count' from Accounts
union  
select 'High Salary' as 'category',count(if(income > 50000,1,null)) as 'accounts_count' from Accounts

三、上级经理已离职的公司员工

1978. 上级经理已离职的公司员工 - 力扣(LeetCode)

子查询没啥好说的

select employee_id
from Employees
where manager_id is not null 
and salary < 30000 
and manager_id not in (select employee_id from Employees)
order by employee_id asc 

http://www.kler.cn/a/612813.html

相关文章:

  • OSPF邻居状态机
  • Java-servlet(十)使用过滤器,请求调度程序和Servlet线程(附带图谱表格更好对比理解)
  • AIGC-评论金句引流回复创作智能体完整指令(DeepSeek,豆包,千问,Kimi,GPT)
  • vueRouter的hash模式跟history的区别
  • 鸿蒙篇:vp、fp、px
  • Java 大视界 -- Java 大数据在智慧港口集装箱调度与物流效率提升中的应用创新(159)
  • Typora使用Gitee作为图床
  • Linux常见使用场景
  • CMake 自己写 findmodule
  • 阿里云国际站代理商:如何通过并行文件系统提升IO性能?
  • 【安全运营】关于攻击面管理相关概念的梳理(二)
  • 论文发表科普知识:什么是南核、北核、CSCD、科技核心、AMI人文核心期刊?
  • JDK 17 + Spring Boot 3 全栈升级实战指南--从语法革新到云原生,解锁企业级开发新范式
  • 笔试专题(四)
  • C++代码脚本实现STM32启动
  • 基于springboot+vue的游戏账号交易系统的设计与实现
  • Android 开发 Gradle 相关问题
  • IIS (Internet Information Services) 基本配置指南
  • 计算机二级WPS Office第四套电子表格
  • 快速排序不啦不啦