![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
文章平均质量分 90
红楼终究一场梦
这个作者很懒,什么都没留下…
展开
-
查询:同一个学校,姓名相同的学生名单。表中包含多个学校学生名单。
现有学生表,包含学校名称,班级,学生姓名等列。需要查询某个学校学生姓名相同的学生的列表。SELECT * FROM `studentInformation` WHERE studentname IN (SELECT studentnameFROM `studentInformation` WHERE school = '西安小学'GROUP BY studentnameHAVING COUNT(studentname) > 1 AND school = '西安小学')GROUP BY.原创 2020-10-19 14:00:03 · 4278 阅读 · 0 评论 -
LeetCode-1369. 获取最近第二次的活动(困难)
表: UserActivity+---------------+---------+| Column Name | Type |+---------------+---------+| username | varchar || activity | varchar || startDate | Date || endDate ...原创 2020-03-11 20:13:44 · 730 阅读 · 0 评论 -
LeetCode-1364. 顾客的可信联系人数量(中等)
顾客表:Customers+---------------+---------+| Column Name | Type |+---------------+---------+| customer_id | int || customer_name | varchar || email | varchar |+---------------+...原创 2020-03-11 18:51:44 · 1055 阅读 · 0 评论 -
LeetCode-1355. 活动参与者(中等)
表: Friends+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || name | varchar || activity | varchar |+---------------+---...原创 2020-03-11 12:32:44 · 779 阅读 · 0 评论 -
LeetCode-1350. 院系无效的学生(简单)
院系表: Departments+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || name | varchar |+---------------+---------+id 是该表的主键该表包含...原创 2020-03-11 11:51:43 · 759 阅读 · 1 评论 -
LeetCode-1341. 电影评分(中等)
表:Movies+---------------+---------+| Column Name | Type |+---------------+---------+| movie_id | int || title | varchar |+---------------+---------+movie_id 是这个表的主键。titl...原创 2020-03-11 11:22:27 · 1371 阅读 · 0 评论 -
LeetCode-1336. 每次访问的交易次数(困难)
表: Visits+---------------+---------+| Column Name | Type |+---------------+---------+| user_id | int || visit_date | date |+---------------+---------+(user_id, visit_date)...原创 2020-03-11 11:04:46 · 1718 阅读 · 0 评论 -
LeetCode-1327. 列出指定时间段内所有的下单产品(简单)
表: Products+------------------+---------+| Column Name | Type |+------------------+---------+| product_id | int || product_name | varchar || product_category | varchar |+...原创 2020-03-11 09:12:49 · 771 阅读 · 0 评论 -
LeetCode-1322. 广告效果(简单)ifnull
表: Ads+---------------+---------+| Column Name | Type |+---------------+---------+| ad_id | int || user_id | int || action | enum |+---------------+-------...原创 2020-03-10 22:01:26 · 1325 阅读 · 0 评论 -
LeetCode-1321. 餐馆营业额变化增长(中等)
表: Customer+---------------+---------+| Column Name | Type |+---------------+---------+| customer_id | int || name | varchar || visited_on | date || amount | i...原创 2020-03-10 21:40:54 · 1585 阅读 · 0 评论 -
LeetCode-1308. 不同性别每日分数总计(中等)
表: Scores+---------------+---------+| Column Name | Type |+---------------+---------+| player_name | varchar || gender | varchar || day | date || score_points | int...原创 2020-03-10 21:05:31 · 758 阅读 · 0 评论 -
LeetCode-1303. 求团队人数(简单)
员工表:Employee+---------------+---------+| Column Name | Type |+---------------+---------+| employee_id | int || team_id | int |+---------------+---------+employee_id 字段是这张表...原创 2020-03-10 20:27:17 · 1542 阅读 · 0 评论 -
LeetCode-1294. 不同国家的天气类型(简单)
国家表:Countries+---------------+---------+| Column Name | Type |+---------------+---------+| country_id | int || country_name | varchar |+---------------+---------+country_id 是这张表的主...原创 2020-03-10 17:37:50 · 711 阅读 · 0 评论 -
LeetCode-1285. 找到连续区间的开始和结束数字(中等)用户变量和循环
表:Logs+---------------+---------+| Column Name | Type |+---------------+---------+| log_id | int |+---------------+---------+id 是上表的主键。上表的每一行包含日志表中的一个 ID。后来一些 ID 从Logs表中删...原创 2020-03-10 17:30:59 · 1097 阅读 · 0 评论 -
LeetCode-1280. 学生们参加各科测试的次数(中等)CROSS JOIN
学生表: Students+---------------+---------+| Column Name | Type |+---------------+---------+| student_id | int || student_name | varchar |+---------------+---------+主键为 student_id(学生...原创 2020-03-10 17:08:30 · 1516 阅读 · 0 评论 -
LeetCode-1270. 向公司CEO汇报工作的所有人(中等)
员工表:Employees+---------------+---------+| Column Name | Type |+---------------+---------+| employee_id | int || employee_name | varchar || manager_id | int |+---------------+...原创 2020-03-09 16:45:46 · 1201 阅读 · 0 评论 -
LeetCode-1264. 页面推荐(中等)
朋友关系列表:Friendship+---------------+---------+| Column Name | Type |+---------------+---------+| user1_id | int || user2_id | int |+---------------+---------+这张表的主键是 (use...原创 2020-03-09 13:38:55 · 722 阅读 · 0 评论 -
LeetCode-1251. 平均售价(简单)
Table: Prices+---------------+---------+| Column Name | Type |+---------------+---------+| product_id | int || start_date | date || end_date | date || price |...原创 2020-03-09 12:20:43 · 1459 阅读 · 0 评论 -
LeetCode-1241. 每个帖子的评论数(简单)
表Submissions 结构如下:+---------------+----------+| 列名 | 类型 |+---------------+----------+| sub_id | int || parent_id | int |+---------------+----------+上表没有主键, ...原创 2020-03-09 11:49:11 · 1731 阅读 · 0 评论 -
LeetCode-1225. 报告系统状态的连续日期(困难)
Table: Failed+--------------+---------+| Column Name | Type |+--------------+---------+| fail_date | date |+--------------+---------+该表主键为 fail_date。该表包含失败任务的天数.Table: Succeeded+-...原创 2020-03-08 12:51:12 · 955 阅读 · 0 评论 -
LeetCode-1212. 查询球队积分(中等)
Table: Teams+---------------+----------+| Column Name | Type |+---------------+----------+| team_id | int || team_name | varchar |+---------------+----------+此表的主键是 team_...原创 2020-03-08 12:15:27 · 1600 阅读 · 0 评论 -
LeetCode-1211. 查询结果的质量和占比(简单)
查询表 Queries:+-------------+---------+| Column Name | Type |+-------------+---------+| query_name | varchar || result | varchar || position | int || rating | int |+--...原创 2020-03-07 12:34:16 · 1124 阅读 · 0 评论 -
LeetCode-1205. 每月交易II(中等)
Transactions 记录表+----------------+---------+| Column Name | Type |+----------------+---------+| id | int || country | varchar || state | enum || amount...原创 2020-03-07 12:02:35 · 1231 阅读 · 0 评论 -
LeetCode-1204. 最后一个能进入电梯的人(中等)自链接
表: Queue+-------------+---------+| Column Name | Type |+-------------+---------+| person_id | int || person_name | varchar || weight | int || turn | int |+-------...原创 2020-03-06 17:03:17 · 980 阅读 · 0 评论 -
LeetCode-1194. 锦标赛优胜者(困难)
Players玩家表+-------------+-------+| Column Name | Type |+-------------+-------+| player_id | int || group_id | int |+-------------+-------+玩家 ID 是此表的主键。此表的每一行表示每个玩家的组。Matches赛事表...原创 2020-03-11 20:20:58 · 1116 阅读 · 1 评论 -
LeetCode-1193. 每月交易 I(中等)DATE_FORMAT COUNT sum(加条件)
Table: Transactions+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || country | varchar || state | enum || amount ...原创 2020-03-04 12:15:41 · 715 阅读 · 0 评论 -
LeetCode-1179. 重新格式化部门表(简单)
部门表Department:+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || revenue | int || month | varchar |+--------------...原创 2020-03-03 12:20:12 · 359 阅读 · 0 评论 -
LeetCode-1174. 即时食物配送 II(中等)
配送表: Delivery+-----------------------------+---------+| Column Name | Type |+-----------------------------+---------+| delivery_id | int || customer_id ...原创 2020-03-03 11:45:36 · 1047 阅读 · 0 评论 -
LeetCode-1173. 即时食物配送 I(简单)
配送表: Delivery+-----------------------------+---------+| Column Name | Type |+-----------------------------+---------+| delivery_id | int || customer_id ...原创 2020-03-03 08:55:59 · 1343 阅读 · 0 评论 -
LeetCode-1164. 指定日期的产品价格(中等)UNION
产品数据表: Products+---------------+---------+| Column Name | Type |+---------------+---------+| product_id | int || new_price | int || change_date | date |+--------------...原创 2020-03-02 16:59:23 · 1312 阅读 · 0 评论 -
LeetCode-1159. 市场分析 II(困难)
表: Users+----------------+---------+| Column Name | Type |+----------------+---------+| user_id | int || join_date | date || favorite_brand | varchar |+---------------...原创 2020-03-02 14:39:10 · 797 阅读 · 0 评论 -
LeetCode-1158. 市场分析 I(中等)
Table: Users+----------------+---------+| Column Name | Type |+----------------+---------+| user_id | int || join_date | date || favorite_brand | varchar |+-----------...原创 2020-03-02 14:13:18 · 1032 阅读 · 0 评论 -
LeetCode-1149. 文章浏览 II(中等)where,having,inner join
Table: Views+---------------+---------+| Column Name | Type |+---------------+---------+| article_id | int || author_id | int || viewer_id | int || view_date | ...原创 2020-03-02 13:36:40 · 599 阅读 · 0 评论 -
LeetCode-1148. 文章浏览 I
Views表:+---------------+---------+| Column Name | Type |+---------------+---------+| article_id | int || author_id | int || viewer_id | int || view_date | date...原创 2020-02-28 17:20:43 · 804 阅读 · 0 评论 -
LeetCode-1142. 过去30天的用户活动 II(简单)
Table: Activity+---------------+---------+| Column Name | Type |+---------------+---------+| user_id | int || session_id | int || activity_date | date || activity_type...原创 2020-02-28 17:03:44 · 1131 阅读 · 0 评论 -
LeetCode-1141. 查询近30天活跃用户数(简单)
活动纪录表:Activity+---------------+---------+| Column Name | Type |+---------------+---------+| user_id | int || session_id | int || activity_date | date || activity_type ...原创 2020-02-28 16:47:11 · 1429 阅读 · 0 评论 -
LeetCode-1132. 报告的记录 II(中等)
动作表:Actions+---------------+---------+| Column Name | Type |+---------------+---------+| user_id | int || post_id | int || action_date | date || action | ...原创 2020-02-28 16:07:34 · 1054 阅读 · 0 评论 -
LeetCode-1127. 用户购买平台(困难)-待深入理解
支出表: Spending+-------------+---------+| Column Name | Type |+-------------+---------+| user_id | int || spend_date | date || platform | enum || amount | int |+-...原创 2020-02-28 09:03:06 · 831 阅读 · 0 评论 -
LeetCode-1126. 查询活跃业务(中等)
事件表:Events+---------------+---------+| Column Name | Type |+---------------+---------+| business_id | int || event_type | varchar || occurences | int |+---------------+--...原创 2020-02-26 08:45:14 · 635 阅读 · 1 评论 -
LeetCode-1113. 报告的记录(简单)ENUM
动作表:Actions+---------------+---------+| Column Name | Type |+---------------+---------+| user_id | int || post_id | int || action_date | date || action | ...原创 2020-02-25 08:56:54 · 780 阅读 · 0 评论