create table salary

来源:百度知道 编辑:UC知道 时间:2024/05/24 15:09:53
create table salary
(sa_id int identity(06211000,1) primary key not null,
em_no int not null,
sa_base money not null,
sa_jiang money not null default '0',
sa_fa money not null default'0',
sa_finally money not null,
foreign key (em_id) references employee(em_id),
constraint a check (sa_finally=sa_base+sa_jiang-sa_fa),
)
我想让sa_finally(最终工资)自动计算,应试如何实现呀?老大。

加触发器!

create table salary
(sa_id int identity(06211000,1) primary key not null,
em_no int not null,
sa_base money not null,
sa_jiang money not null default '0',
sa_fa money not null default'0',
sa_finally as sa_base+sa_jiang-sa_fa,
foreign key (em_id) references employee(em_id),
)