← Back to Constraints
Question 66
Every Building Needs a Name
Every Building Needs a Name
Create a table calledbuildingswith three columns:id(anINTEGER PRIMARY KEY),name(TEXT, required: a row without a name must be rejected) andaddress(TEXT, optional, so it may be left empty). Onlynameneeds 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
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.