Employee
Employee
go
use employee_management;
go
--1
create table employee
(
EmpNo int primary key,
EmpName varchar(30),
BirthDay smalldatetime,
DeptNo int not null,
MgrNo tinyint not null,
StartDate smalldatetime,
Salary money,
Level tinyint,
Status tinyint,
Note varchar(200),
constraint ck_level check (Level >=1 and Level <=7),
constraint ck_status check (Status in (0,1,2))
)
/*2.2*/
ALTER TABLE EMPLOYEE
ADD
CONSTRAINT df_EMPLOYEE
DEFAULT 0 FOR MgrNo,
DEFAULT 0 FOR Status;
--3
alter table employee
add
constraint fk_deptNo foreign key (DeptNo) references
department(DeptNo)
--4
set dateformat dmy