LeetCode 高频 SQL 50 题(基础版)之 【高级字符串函数 / 正则表达式 / 子句】· 上

题目:1667. 修复表中的名字



题解:

sql 复制代码
select user_id, concat(upper(left(name,1)),lower(right(name,length(name)-1)))  name 
from Users
order by user_id

题目:1527. 患某种疾病的患者



题解:

sql 复制代码
select * from Patients
where conditions regexp '^DIAB1|\\sDIAB1'

题目:196. 删除重复的电子邮箱



题解:

sql 复制代码
delete p1 
from Person p1,Person p2
where p1.email=p2.email and p1.id>p2.id

题目:176. 第二高的薪水



题解:

sql 复制代码
select ifNUll((select distinct salary 
from Employee
order by salary desc
limit 1,1),null) SecondHighestSalary
相关推荐
旺仔不是程序员2 分钟前
LIMIT 1:PostgreSQL 只取一行的高效查询姿势
数据库·后端·sql
Tim_1012 分钟前
【LeetCode】338、比特位计数
c++·算法·leetcode
木子算法27 分钟前
不是重心也不是中点:费马—韦伯点、它的最优性条件与迭代求解
人工智能·算法·目标跟踪
tryxr1 小时前
矩阵的几种基础变换
java·数据结构·算法·矩阵
mmmmath_32 小时前
LeetCode.028.找出字符串中第一个匹配项的
数据结构·算法·leetcode
Selvaggia2 小时前
DMD(Distribution Matching Distillation,分布匹配蒸馏)
算法
Navigator_Z2 小时前
LeetCode //C - 1255. Maximum Score Words Formed by Letters
c语言·算法·leetcode
All for pursuit.2 小时前
【栈-4】739.每日温度
数据结构·c++·算法·leetcode
开开心心就好2 小时前
安卓手写文字生成工具,多种纸张一直免费
网络·网络协议·tcp/ip·leetcode·智能手机·电脑·模拟退火算法