MySqlデータベースに「salary_mst」という名前のテーブルを作成しました。テーブルのフィールドは
id -> auto increment
name -> varchar(50)
salary -> double
誰かが給与に値を挿入しない場合、デフォルトの0.00を保存する必要があります
ALTER TABLE `table` ADD COLUMN `column` FLOAT(10,2) NOT NULL DEFAULT '0.00'
create table salary_mst (
id int not null primary key auto_increment,
name varchar(50),
salary double not null default 0
);
テストする:
insert into salary_mst (name) values ('foo');
select * from salary_mst;
+----+------+--------+
| id | name | salary |
+----+------+--------+
| 1 | foo | 0 |
+----+------+--------+