leetcode 高频SQL50题

单表查询

sql 复制代码
-- 584. is Null, !=
select name from Customer 
where referee_id != 2 or referee_id is Null

-- 595. >=
select name, population, area
from World
where area >= 3000000 or population >=25000000

-- 1148. 去重 distinct author_id as id
select distinct author_id as id from Views
where author_id = viewer_id 
order by author_id;

-- 1683. 函数 char_length 返回字符串长度
-- length 返回字节数, 对于ASCII之外的不适用
select tweet_id from tweets
where char_length(content) > 15

多表查询

sql 复制代码
-- 1378. left join 将两个表的数据基于 id 列进行组合
select e.name, eu.unique_id from Employees as e
left join EmployeeUNI as eu
on eu.id = e.id
相关推荐
jiunian_cn3 分钟前
【Redis】数据库管理操作
数据库·redis·缓存
铉铉这波能秀9 分钟前
LeetCode Hot100数据结构背景知识之元组(Tuple)Python2026新版
数据结构·python·算法·leetcode·元组·tuple
_Johnny_27 分钟前
ETCD 配额/空间告警模拟方案
网络·数据库·etcd
猫头虎39 分钟前
基于信创openEuler系统安装部署OpenTeleDB开源数据库的实战教程
数据库·redis·sql·mysql·开源·nosql·database
爬山算法44 分钟前
MongoDB(1)什么是MongoDB?
数据库·mongodb
Nandeska1 小时前
17、MySQL InnoDB ReplicaSet
数据库·mysql
AI_56781 小时前
SQL性能优化全景指南:从量子执行计划到自适应索引的终极实践
数据库·人工智能·学习·adb
铉铉这波能秀1 小时前
LeetCode Hot100数据结构背景知识之字典(Dictionary)Python2026新版
数据结构·python·算法·leetcode·字典·dictionary
我是咸鱼不闲呀1 小时前
力扣Hot100系列20(Java)——[动态规划]总结(下)( 单词拆分,最大递增子序列,乘积最大子数组 ,分割等和子集,最长有效括号)
java·leetcode·动态规划
唐梓航-求职中1 小时前
编程-技术-算法-leetcode-288. 单词的唯一缩写
算法·leetcode·c#