最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Leetcode601.Human Traffic of Stadium

2022-10-08 08:27 作者:您是打尖兒還是住店呢  | 我要投稿

SQL Schema

Table:?Stadium

+---------------+---------+?

| Column Name ? | Type?|

+---------------+---------+?

| id ? ? ? ? ? ?| int ? ? |?

| visit_date ? ?| date ? ?|

| people ? ? ? ?| int ? ? |?

+---------------+---------+?

visit_date is the primary key for this table. Each row of this table contains the visit date and visit id to the stadium with the number of people during the visit. No two rows will have the same visit_date, and as the id increases, the dates increase as well.

?

Write an SQL query to display the records with three or more rows with?consecutive?id's, and the number of people is greater than or equal to 100 for each.

Return the result table ordered by?visit_date?in?ascending order.

The query result format is in the following example.

?

Example 1:

Input: Stadium table:

+------+------------+-----------+?

| id ? | visit_date | people ? ?|?

+------+------------+-----------+?

| 1 ? ?| 2017-01-01 | 10 ? ? ? ?|

| 2 ? ?| 2017-01-02 | 109 ? ? ? |?

| 3 ? ?| 2017-01-03 | 150 ? ? ? |?

| 4 ? ?| 2017-01-04 | 99 ? ? ? ?|?

| 5 ? ?| 2017-01-05 | 145 ? ? ? |?

| 6 ? ?| 2017-01-06 | 1455 ? ? ?|?

| 7 ? ?| 2017-01-07 | 199 ? ? ? |

| 8 ? ?| 2017-01-09 | 188 ? ? ? |?

+------+------------+-----------+

Output:?

+------+------------+-----------+?

| id ? | visit_date | people ? ?|

+------+------------+-----------+?

| 5 ? ?| 2017-01-05 | 145 ? ? ? |?

| 6 ? ?| 2017-01-06 | 1455 ? ? ?|

| 7 ? ?| 2017-01-07 | 199 ? ? ? |?

| 8 ? ?| 2017-01-09 | 188 ? ? ? |

+------+------------+-----------+

Explanation:?

The four rows with ids 5, 6, 7, and 8 have consecutive ids and each of them has >= 100 people attended. Note that row 8 was included even though the visit_date was not the next day after row 7. The rows with ids 2 and 3 are not included because we need at least three consecutive ids.

什么時(shí)候?qū)谝仓С謒arkdown就好了。

Leetcode601.Human Traffic of Stadium的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
商洛市| 措勤县| 南雄市| 吉安市| 镇巴县| 神木县| 屯门区| 乃东县| 镇巴县| 安国市| 陵川县| 页游| 前郭尔| 当涂县| 南通市| 岱山县| 富裕县| 沁水县| 澎湖县| 齐河县| 嘉兴市| 芮城县| 古交市| 伊宁市| 嘉祥县| 土默特左旗| 宜宾市| 荆州市| 乌兰浩特市| 璧山县| 章丘市| 高邑县| 丰宁| 额尔古纳市| 梧州市| 公主岭市| 阜康市| 会理县| 鄂尔多斯市| 泸西县| 云和县|