CJCoding With Joseph
15free / daySign inCreate account

Ticket Priority From a Fixed List

Create a table called support_tickets with four columns: id (an INTEGER PRIMARY KEY), student_id (INTEGER, required), subject (TEXT, required) and priority (TEXT, required, defaulting to 'normal'). The priority may only be 'low', 'normal' or 'high': write that as a CHECK with an IN list, so a ticket marked 'urgent' is rejected while one that leaves the priority out is accepted with 'normal'.

Expected result:

Table support_tickets
✓ id INTEGER PRIMARY KEY
✓ student_id INTEGER NOT NULL
✓ subject TEXT NOT NULL
✓ priority TEXT NOT NULL DEFAULT 'normal'
✓ Insert a ticket with priority 'urgent': rejected (CHECK)
✓ Insert a ticket without a priority: accepted
✓ Insert a ticket with priority 'high': accepted
Hints3 available
Topics:
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.