I have created a table with a default column value
CREATE TABLE Persons
sex varchar(5) default 'male')
INSERT INTO Persons values('Bob', 20)
INSERT INTO Persons(name,sex) values('Bob', 20)
column name or number of supplied values does not match table definition
Well, in your statement #1, if you omit the list of columns, you must supply values for all three columns, and you're not doing that. That's why it fails if you provide only two of those values.
And your statement #2 should probably be:
INSERT INTO Persons(name, age) values('Bob', 20)
and then you're clearly specifying which columns to insert into (
age) and you're providing the two values required to fill two columns - that's why it works. The third column will be filled with the configured default, since you didn't specify anything for it.
For these reasons, I would recommend to always explicitly specify the list of columns you want to insert data into - don't just omit that list and assume that you're getting all columns right.....