CJCoding With Joseph
15free / daySign inCreate account

Every Building Needs a Name

Create a table called buildings with three columns: id (an INTEGER PRIMARY KEY), name (TEXT, required: a row without a name must be rejected) and address (TEXT, optional, so it may be left empty). Only name needs an extra rule.

Expected result:

Table buildings
✓ id INTEGER PRIMARY KEY
✓ name TEXT NOT NULL
✓ address TEXT
✓ Insert a building with no name: rejected (NOT NULL)
✓ Insert a building with a name but no address: 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.