← Back to CREATE TABLE
Question 89
Prices Are Not Whole Numbers
Prices Are Not Whole Numbers
CreatetextbookswithidINTEGER PRIMARY KEY,titleTEXT NOT NULL,priceREAL NOT NULLandpagesINTEGER(optional).REALis the SQLite type for numbers with a decimal part, which is what a price like 89.99 needs; a textbook with a title but no price must be refused.
Expected result:
Table textbooks ✓ id INTEGER PRIMARY KEY ✓ title TEXT NOT NULL ✓ price REAL NOT NULL ✓ pages INTEGER ✓ A textbook priced 89.99: accepted ✓ A textbook with no price: rejected (NOT NULL)
Hints3 available
Sign in to use hintsTopics:
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.