create database sss
--Employee(EmployeeID,Name,Birthday,Sex,Address,Zip,PhoneNumber,EmailAddress,DepartmentID)
--Departments(DepartmentID,DepartmentName,Note)
--Salary(EmployeeID,Income,OutCome)
create table Employee(
EmployeeID char(6) NOT NULL,
Name char(10) not null,
Birthday datetime not null,
Sex bit not null,
Address char(20),
Zip char(6),
PhoneNumber char(12),
EmailAddress char(30),
DepartmentID char(3) not null,
primary key(EmployeeID)
);
create table Department(
DepartmentID char(3) NOT NULL ,
DepartmentName char(20),
Note text,
primary key(DepartmentID)
);
create table Salary(
EmployeeID char(6)not null unique,
Income float(8)not null,
OutCome float(8) not null
);
INSERT INTO Department VALUES('1','财务部','财务部');
INSERT INTO Department VALUES('2','研发部','研发部');
INSERT INTO Department VALUES('3','人力资源部','人力资源部');
INSERT INTO Employee VALUES('1001' ,'李勇', '78-3-12', '0', '河南', '475001', '3880378','ly@henu.edu.cn','1');
INSERT INTO Employee VALUES('1002' ,'王敏', '80-11-2', '1', '河南', '475002', '0378311','wm@henu.edu.cn','1');
INSERT INTO Employee VALUES('1003' ,'刘晨', '78-6-22', '0', '河南', '475003', '0378322','lc@henu.edu.cn','1');
INSERT INTO Employee VALUES('1004' ,'周宏', '83-10-3', '1', '河北', '475004', '7865987','zh@henu.edu.c
数据库建表 以及查询练习 SQL server2008R2
最新推荐文章于 2022-10-30 08:32:57 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)