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
相关推荐
jnrjian20 小时前
text index 查看index column index定义 index 刷新频率 index视图
数据库·oracle
小白菜又菜20 小时前
Leetcode 2075. Decode the Slanted Ciphertext
算法·leetcode·职场和发展
瀚高PG实验室20 小时前
审计策略修改
网络·数据库·瀚高数据库
言慢行善21 小时前
sqlserver模糊查询问题
java·数据库·sqlserver
韶博雅21 小时前
emcc24ai
开发语言·数据库·python
有想法的py工程师21 小时前
PostgreSQL 分区表排序优化:Append Sort 优化为 Merge Append
大数据·数据库·postgresql
迷枫71221 小时前
达梦数据库的体系架构
数据库·oracle·架构
夜晚打字声1 天前
9(九)Jmeter如何连接数据库
数据库·jmeter·oracle
Chasing__Dreams1 天前
Mysql--基础知识点--95--为什么避免使用长事务
数据库·mysql
NineData1 天前
NineData 智能数据管理平台新功能发布|2026 年 3 月
数据库·oracle·架构·dba·ninedata·数据复制·数据迁移工具