Reusing part of a unique pair

A workspace uses the following SQL definition to identify desks within different sites. A desk number may be reused at another site.


SQL
CREATE TABLE Desk (
    site_code INTEGER NOT NULL,
    desk_number INTEGER NOT NULL,
    UNIQUE (site_code, desk_number)
);


The table currently contains exactly these rows:


site_code

desk_number

10

1

10

2

20

1


For each candidate row below, enter yes if insertion is permitted or no if it is rejected. Test every candidate independently against the original three rows; no candidate is actually added. There are no other constraints or triggers.

Site codeDesk numberInsertion permitted
101
103
202
301
201

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More SQL Basics Questions: