← Back to Constraints
Question 67
One Permit Per Licence Plate
One Permit Per Licence Plate
Create a table calledparking_permitswith three columns:id(anINTEGER PRIMARY KEY),plate(TEXT) andstudent_id(INTEGER). A licence plate can hold only one permit, so two rows with the sameplatemust be rejected; everything else, including one student holding two plates, is allowed.
Expected result:
Table parking_permits ✓ id INTEGER PRIMARY KEY ✓ plate TEXT ✓ student_id INTEGER ✓ UNIQUE (plate) ✓ Insert the same plate twice: rejected (UNIQUE) ✓ Insert two different plates for one student: accepted
Hints3 available
Sign in to use hintsTopics:
Constraints
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.