create database DemoDB2008
go
use DemoDB2008
go
create table Departments
(
departmentID
int identity(1,1)
primary key,
departmentName
varchar(50)
unique not null,
departmentRemark
varchar(200)
null )
insert into Departments(departmentName,departmentRemark)
values(
'人事部',
'负责人事等')
insert into Departments(departmentName,departmentRemark)
values(
'市场部',
'负责销售等')
insert into Departments(departmentName,departmentRemark)
values(
'研发部',
'负责产品研发等')
insert into Departments(departmentName,departmentRemark)
values(
'开发部',
'负责软件开发,外包,培训等')
--select * from Departments create table Employees
(
EmployeeID
int identity(1,1)
primary key,
DepartmentID
int foreign key references Departments(departmentID),
EmployeeName
varchar(50)
not null,
Gender
varchar(4)
null,
BirthDate
datetime null,
HireDate
datetime null,
Extension
varchar(30)
null,
Mobile
varchar(30)
null,
EMail
varchar(50)
null,
Address
varchar(200)
null )
--select * from Employees insert into Employees(DepartmentID,EmployeeName,Gender,BirthDate,HireDate,Extension,Mobile)
values(1,
'Tom',
'男',
'1983-1-5',
'2005-3-5',
'865',
'13918182356')
insert into Employees(DepartmentID,EmployeeName,Gender,BirthDate,HireDate,Extension,Mobile)
values(1,
'Jack',
'男',
'1982-11-12',
'2005-3-5',
'866',
'13855663278')
insert into Employees(DepartmentID,EmployeeName,Gender,BirthDate,HireDate,Extension,Mobile)
values(2,
'Ailce',
'女',
'1985-6-9',
'2006-10-5',
'851',
'13667231659')
insert into Employees(DepartmentID,EmployeeName,Gender,BirthDate,HireDate,Extension,Mobile)
values(2,
'Jerry',
'男',
'1982-10-25',
'2003-10-5',
'868',
'13866882535')
insert into Employees(DepartmentID,EmployeeName,Gender,BirthDate,HireDate,Extension,Mobile)
values(2,
'Lucy',
'女',
'1984-8-26',
'2004-9-1',
'867',
'13561866125')