I set a id field as my primary key and assigned a default value but when I test, it wont follow my default value, why? I assigned it with a value of 1 but instead will generate this 54869. Any suggestion?
Primary key
[deleted]
Primary keys are 'unique' by default. That means that setting a default value is useless because you may not ever insert the same value twice.
The 54869 is probably generated by the database itself, either through setting the column to 'auto_increment' (mysql) or serial (informix/postgres/oracle)
That wil automatically generate a new and unique number to be inserted into the primarykey field.
Coz I want to assigned a default value and let it auto increment itself. And I want to assign this field as my primary key. Is there other way to solve this problem?
[deleted]
You may want to grab your database's manual are read up on the use of default values and auto_increment.
The two have nothing to do with eachother.