+-------------+------+
|Column Name |Type|+-------------+------+
| seat_id | int ||free| bool |+-------------+------+
seat_id is an auto-incrementcolumnfor this table.
Eachrowof this table indicates whether the ith seat isfreeornot. 1 means free while 0 means occupied.
Find all the consecutive available seats in the cinema.
Return the result table ordered by seat_idin ascending order.
The test cases are generated so that more than two seats are consecutively available.
select c1.seat_id
from cinema c1, cinema c2
where ((c1.seat_id = c2.seat_id+1) or (c1.seat_id = c2.seat_id-1)) and (c1.free=1) and (c2.free=1)
groupby c1.seat_id