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
相关推荐
春日见12 分钟前
控制算法:PP(纯跟踪)算法
linux·人工智能·驱动开发·算法·机器学习
智者知已应修善业16 分钟前
【编写函数求表达式的值】2024-4-3
c语言·c++·经验分享·笔记·算法
sinat_2869451928 分钟前
opencode
人工智能·算法·chatgpt
工口发动机1 小时前
ABC440DEF简要题解
c++·算法
C++ 老炮儿的技术栈1 小时前
什么是通信规约
开发语言·数据结构·c++·windows·算法·安全·链表
kejiayuan1 小时前
CTE更易懂的SQL风格
数据库·sql
零小陈上(shouhou6668889)1 小时前
K-近邻算法 - lazy learning的代表
算法·近邻算法
有一个好名字1 小时前
力扣-从字符串中移除星号
java·算法·leetcode
萧瑟其中~1 小时前
二分算法模版——基础二分查找,左边界查找与右边界查找(Leetcode的二分查找、在排序数组中查找元素的第一个位置和最后一个位置)
数据结构·算法·leetcode
码上就好ovo1 小时前
Atcoder Beginnner Contest 440
算法