The default values for columns is valuable because it enforces data integrity and ensures that a value is entered on the database. It also means that some SQL statements are smaller than others. A standard type of statement without its column being added is an id
field, where the primary key is defined, and when an INSERT
statement is used, the id
field is not required, as shown in the following.
The DBA can create columns to store current_timestamp
in the database automatically, which is good for logging and time stamping.
sqlite> INSERT into salary (name, salary, bonus) values ('John Smith',15000,2000); sqlite> SELECT * FROM salary; id name salary bonus ----- -------- --------- -------- 1 Peter Jones 10000 3000 2 Sam Smith 15000 1000 3 John Smith 15000 2000