SQL DEFAULT CONSTRAINT not working


#1

Hello, I created a Persons table just like the example given here and found out the schema , and had given the city name as default ‘sandser’, but I get the following error in sqlite from the command line.

The schema is as follows:
sqlite> PRAGMA table_info([Persons]);
0|ID|INT|1||0
1|LastName|VARCHAR(255)|1||0
2|FirstName|VARCHAR(255)|0||0
3|Age|INT|0||0
4|CITY|VARCHAR(255)|0|‘Sandnes’|0

sqlite> INSERT INTO Persons VALUES (1, “Bale”, “Christian”, “44”);
Error: table Persons has 5 columns but 4 values were supplied
sqlite>

Why isn’t the DEFAULT constraint working for my column city?

picx


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.