CJCoding With Joseph
15free / daySign inCreate account

Fill the Blanks With Defaults

Create events with four columns: id INTEGER PRIMARY KEY; title TEXT NOT NULL; attendees INTEGER NOT NULL DEFAULT 0; and is_public INTEGER NOT NULL DEFAULT 1. An insert that supplies only a title must succeed, with the counter at 0 and the flag at 1, while an insert that leaves the title out, or sets the counter to NULL on purpose, must be refused.

Expected result:

Table events
✓ id INTEGER PRIMARY KEY
✓ title TEXT NOT NULL
✓ attendees INTEGER NOT NULL DEFAULT 0
✓ is_public INTEGER NOT NULL DEFAULT 1
✓ An event given only a title: accepted
✓ An event with no title: rejected (NOT NULL)
✓ An event whose attendee count is set to NULL: rejected (NOT NULL)
Hints3 available
Topics:
CREATE TABLE
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.