MySQL error
#10

See indeed Sia's answer. To explain it a bit futher:

Quote:

Field 'spvip' doesn't have a default value

You didn't specify this column in the INSERT query. When you don't, the server requires a default value to be set if it also may not be empty (NOT NULL).
Look at this table:
Code:
CREATE TABLE test(
    Foo INT NOT NULL,
    Required INT NOT NULL DEFAULT 1,
    Bar INT DEFAULT 5,
    Not_Required INT,
    spvip MEDIUMINT(2) NOT NULL
);
When using the INSERT query:
- You must provide a value for Foo: It may not be null and has no default value.
- You don't have to provide a value for Required: It may not be null but it has a default value. Not specifying Required in an INSERT statement will set it's value to 1
- You don't have to provide a value for Bar. It may be null. If you don't specify it, it will be set to 5.
- You don't have to provide a value for Not_Required. It may be null and it doesn't have a default value. When not specyfing one it will be empty (NULL)
- You must provide a value for spvip. It may not be null and has no default value.

Thus using this query would be valid:
Code:
INSERT INTO test (Foo, spvip) VALUES (10, 0);
This query would return the error you're currently getting, because spvip has no default value and also is required to have a value:
Code:
INSERT INTO test (Foo, Required, Bar, Not_Required) VALUES (10, 0, 6, NULL);
I hope that clears things up a bit more.
Reply


Messages In This Thread
MySQL error - by PemburuHantu - 23.04.2020, 01:01
Re: MySQL error - by NeamPojma - 23.04.2020, 01:43
Re: MySQL error - by PemburuHantu - 23.04.2020, 02:10
Re: MySQL error - by SiaReyes - 23.04.2020, 04:23
Re: MySQL error - by PemburuHantu - 23.04.2020, 05:50
Re: MySQL error - by PemburuHantu - 25.04.2020, 01:49
Re: MySQL error - by SiaReyes - 25.04.2020, 01:52
Re: MySQL error - by ShadowMortar - 25.04.2020, 07:47
Re: MySQL error - by Kent - 25.04.2020, 11:41
Re: MySQL error - by Kwarde - 25.04.2020, 14:57

Forum Jump:


Users browsing this thread: 1 Guest(s)