![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode SQL
文章平均质量分 90
itslifeng
这个作者很懒,什么都没留下…
展开
-
Exist和in的区别
Existselect book_keyfrom bookwhere exists (select book_key from sales);Inselect book_keyfrom bookwhere book_key in (select book_key from sales);The EXISTS clause is much faster than IN when the subquery results is very large.原创 2020-09-22 01:29:37 · 227 阅读 · 0 评论 -
Leetcode - SQL 1158 -Case When使用
这里写目录标题题目思路题目Write an SQL query to find for each user, the join date and the number of orders they made as a buyer in 2019.The query result format is in the following example:Users table:±--------±-----------±---------------+| user_id | join_date |原创 2020-09-22 00:45:44 · 160 阅读 · 0 评论 -
LeetCode - SQL 603 - 取该列连续的三位数(LEAD和 LAG的使用)
这里写目录标题题目思路思路2题目Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you help to query all the consecutive available seats order by the seat_id using the following cinema table?seat_idfree1120原创 2020-09-20 04:49:21 · 320 阅读 · 0 评论 -
LeetCode - SQL 597 -两个group bys 代替 distinct
目录题目:思路:题目:In social network like Facebook or Twitter, people send friend requests and accept others’ requests as well. Now given two tables as below:Table: friend_requestsender_idsend_to_idrequest_date122016_06-01132016_06-01142原创 2020-09-19 05:13:06 · 123 阅读 · 0 评论