Skip to content

Commit 44d1f51

Browse files
refactor 603
1 parent 0fc836b commit 44d1f51

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

database/_603.sql

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
--603. Consecutive Available Seats
2-
--
3-
--Several friends at a cinema ticket office would like to reserve consecutive available seats.
4-
--Can you help to query all the consecutive available seats order by the seat_id using the following cinema table?
5-
--
6-
--| seat_id | free |
7-
--|---------|------|
8-
--| 1 | 1 |
9-
--| 2 | 0 |
10-
--| 3 | 1 |
11-
--| 4 | 1 |
12-
--| 5 | 1 |
13-
--Your query should return the following result for the sample case above.
14-
--| seat_id |
15-
--|---------|
16-
--| 3 |
17-
--| 4 |
18-
--| 5 |
19-
--Note:
20-
--The seat_id is an auto increment int, and free is bool ('1' means free, and '0' means occupied.).
21-
--Consecutive available seats are more than 2(inclusive) seats consecutively available.
22-
231
select c.seat_id from cinema c where c.free = 1
242
and
253
(

0 commit comments

Comments
 (0)