Skip to content

Commit bb161b4

Browse files
Dhoni77poyea
andauthored
feat: add sql solution to lc problem: No.0603 (doocs#750)
No.0603.Consecutive Available Seats Co-authored-by: John Law <johnlaw.po@gmail.com>
1 parent ac11d9a commit bb161b4

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

solution/0600-0699/0603.Consecutive Available Seats/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ Cinema 表:
6262
### **SQL**
6363

6464
```sql
65-
65+
SELECT c1.seat_id
66+
FROM Cinema c1,
67+
Cinema c2
68+
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
69+
OR ( c1.seat_id = c2.seat_id - 1 ) )
70+
AND ( c1.free = 1
71+
AND c2.free = 1 )
72+
GROUP BY seat_id;
6673
```
6774

6875
<!-- tabs:end -->

solution/0600-0699/0603.Consecutive Available Seats/README_EN.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ Cinema table:
5959
### **SQL**
6060

6161
```sql
62-
62+
SELECT c1.seat_id
63+
FROM Cinema c1,
64+
Cinema c2
65+
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
66+
OR ( c1.seat_id = c2.seat_id - 1 ) )
67+
AND ( c1.free = 1
68+
AND c2.free = 1 )
69+
GROUP BY seat_id;
6370
```
6471

6572
<!-- tabs:end -->
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SELECT c1.seat_id
2+
FROM Cinema c1,
3+
Cinema c2
4+
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
5+
OR ( c1.seat_id = c2.seat_id - 1 ) )
6+
AND ( c1.free = 1
7+
AND c2.free = 1 )
8+
GROUP BY seat_id;

0 commit comments

Comments
 (0)