Problem Description

In Seats(bus_id, seat_no, status), seat_no should be unique per bus only for active seats (status='ACTIVE'). Write a SQL approach that enforces it using a separate table ActiveSeats and FK/PK.

Input Format

SQL DDL

Output Format

DDL statement(s)

Sample Test Case

Input:
Seats(bus_id, seat_no, status)
Output:
Design created

Constraints

Use a helper table to enforce partial uniqueness

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next