摘要: 从不订购的客户 select c.Name as Customers from Customers c left join Orders o on c.Id = o.CustomerId where o.CustomerId is null select customers.name custome 阅读全文
posted @ 2023-04-11 15:54 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 查找重复的电子邮箱 对于mysql来说 inner join 就是在做笛卡尔积 select email as Email from Person group by email having count(email) > 1 select email as Email from ( select e 阅读全文
posted @ 2023-04-11 15:44 Carl_ZhangJH 阅读(10) 评论(0) 推荐(0)
摘要: 超过经理收入的员工 select e1.name as Employee from Employee e1, Employee e2 where e1.managerId = e2.id and e1.salary > e2.salary select e1.name as Employee fro 阅读全文
posted @ 2023-04-11 15:19 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 连续出现的数字 select distinct l1.num as ConsecutiveNums from Logs l1, Logs l2, Logs l3 where l1.id = l2.id - 1 and l2.id = l3.id - 1 and l1.num = l2.num and 阅读全文
posted @ 2023-04-11 12:24 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 分数排名 select s1.score, count(distinct s2.score) as `rank` from Scores as s1, Scores as s2 where s1.score <= s2.score group by s1.id order by s1.score d 阅读全文
posted @ 2023-04-10 17:55 Carl_ZhangJH 阅读(21) 评论(0) 推荐(0)
摘要: 第N高的薪水 CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN declare T int default 0; SET T = N-1; RETURN ( # Write your MySQL query statement 阅读全文
posted @ 2023-04-10 17:00 Carl_ZhangJH 阅读(12) 评论(0) 推荐(0)
摘要: 第二高的薪水,查第二高的人的信息 1、使用ifnull(exp1, exp2)函数,limit offset子句 select ifnull( (select distinct salary from Employee order by salary desc limit 1 offset 1), 阅读全文
posted @ 2023-03-29 16:48 Carl_ZhangJH 阅读(19) 评论(0) 推荐(0)
摘要: 组合两个表 使用左连接 left join select p.firstName, p.lastName, a.city, a.state from Person as p left join Address as a on a.PersonId = p.PersonId 阅读全文
posted @ 2023-03-29 14:40 Carl_ZhangJH 阅读(8) 评论(0) 推荐(0)
摘要: redis-server --service-start 启动redis服务 winpty redis-cli 进入redis-cli, 可查看存入的数据 redis环境配好之后,先 npm i redis@3.1.2 安装nodejs环境下的redis库 然后node test.js 编译以下js 阅读全文
posted @ 2022-08-15 18:15 Carl_ZhangJH 阅读(2953) 评论(0) 推荐(1)
摘要: 1、redis下载途径 https://github.com/tporadowski/redis/releases 本人网盘附带下载好的zip免安装包 链接: https://pan.baidu.com/s/16SQhuGLTbE8wsIp9cMIwTQ 提取码: c1km 2、配置redis 解压 阅读全文
posted @ 2022-08-15 15:10 Carl_ZhangJH 阅读(4114) 评论(0) 推荐(0)