Ai
1 Star 0 Fork 0

逸扬/leetcode-hub-mysql

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
lc-0614.test 765 Bytes
Copy Edit Raw Blame History
逸扬 authored 2022-05-01 21:45 +08:00 . 602-610-612-613-614-615-620-1068-1069-1070 (10)
# $614. 二级关注者
# https://leetcode-cn.com/problems/second-degree-follower/
# SQL架构
Create table If Not Exists Follow (followee varchar(255), follower varchar(255));
Truncate table Follow;
insert into Follow (followee, follower) values ('Alice', 'Bob');
insert into Follow (followee, follower) values ('Bob', 'Cena');
insert into Follow (followee, follower) values ('Bob', 'Donald');
insert into Follow (followee, follower) values ('Donald', 'Edward');
# Write your MySQL query statement below
select
followee as follower,
count(follower) as num
from
Follow
where
followee in (
select
distinct follower
from
Follow
)
group by
followee
order by
followee;
# clean-up
drop table Follow;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gdut_yy/leetcode-hub-mysql.git
git@gitee.com:gdut_yy/leetcode-hub-mysql.git
gdut_yy
leetcode-hub-mysql
leetcode-hub-mysql
master

Search