← Back to Views & Indexes
Question 61
Drop a Mistaken Unique Index
Drop a Mistaken Unique Index
The first statement in the editor creates a unique index calledidx_courses_roomoncourses(room). That is a mistake: two courses can share a room in different semesters, and the index now blocks any new course in a room that is already in use. Leave the first statement in place and write the statement that removes the index, so that a second course in roomT-100can be inserted again.
Expected result:
Table courses ✓ id INTEGER PRIMARY KEY ✓ code TEXT NOT NULL ✓ title TEXT NOT NULL ✓ department_id INTEGER NOT NULL ✓ instructor_id INTEGER ✓ credits INTEGER NOT NULL DEFAULT 3 ✓ level INTEGER NOT NULL ✓ max_seats INTEGER ✓ room TEXT ✓ semester TEXT ✓ fee REAL ✓ instructor_id REFERENCES instructors(id) ✓ department_id REFERENCES departments(id) ✓ UNIQUE (code) ✓ Insert a second course in room T-100: accepted
Hints2 available
Sign in to use hintsTopics:
Views & Indexes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)
Results
Run your SQL to see every statement's output here, then how it compares with the expected answer.
Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.