From 48144731ab29462cc47c07bc3c7d691bb7853221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E5=85=86=E6=98=8E?= <2692544974@qq.com> Date: Mon, 29 Aug 2022 03:31:00 +0000 Subject: [PATCH] =?UTF-8?q?33=E8=B0=B7=E5=85=86=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 谷兆明 <2692544974@qq.com> --- ...33\350\260\267\345\205\206\346\230\216.md" | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 "33\350\260\267\345\205\206\346\230\216/33\350\260\267\345\205\206\346\230\216.md" diff --git "a/33\350\260\267\345\205\206\346\230\216/33\350\260\267\345\205\206\346\230\216.md" "b/33\350\260\267\345\205\206\346\230\216/33\350\260\267\345\205\206\346\230\216.md" new file mode 100644 index 0000000..178e9eb --- /dev/null +++ "b/33\350\260\267\345\205\206\346\230\216/33\350\260\267\345\205\206\346\230\216.md" @@ -0,0 +1,64 @@ +```sql +create database DBTEST +go + +use DBTEST +go + +--*部门信息表* +create table sectionInfo( +sectionID int primary key identity(1,1),--部门编号 +sectionName varchar(10) not null --部门名称 +) + +insert sectionInfo(sectionName) +values('技术部'), + ('卫生部'), + ('财务部'), + ('人事部'), + ('会计部') + + +--*员工信息表* +create table userInfo( +userNo int primary key identity(100,1),--员工编号 +userName varchar(10) unique not null check(len(userName)>4),--员工姓名 +userSex varchar(2) check(userSex='男' or userSex='女') not null,--员工性别 +userAge int check(userAge between 0 and 100) not null , --员工年龄 +userAddress varchar(50) default('湖北') not null, --员工地址 +userSection int foreign key references sectionInfo(sectionID) --员工部门 +) + +insert userInfo(userName,userSex,userAge,userAddress,userSection) +values('张三das','男',20,'河南省',2), + ('李四sda','女',18,'北京',3), + ('王五asd','男',20,'福建省',2), + ('赵六sad','女',30,'河南省',1), + ('田七sad','男',19,'湖南省',2) + +--*员工考勤表* +create table workInfo( +workId int primary key identity(1,1),--考勤编号 +userId int foreign key references userInfo(userNo) not null, --考勤员工 +workTime datetime not null,--考勤时间 +workDescription varchar(40) check(workDescription='迟到' or + workDescription='早退' or + workDescription='矿工' or + workDescription='病假' or + workDescription='事假') not null --考勤说明 + ) + +insert workInfo(userId,workTime,workDescription) +values (106,'2022-08-17 20:00:00','迟到'), + (107,'2022-08-17 20:00:00','迟到'), + (109,'2022-07-17 20:00:00','迟到'), + (108,'2022-04-16 20:00:00','迟到'), + (108,'2022-03-17 20:00:00','迟到') + + +select * from sectionInfo +select * from userInfo +select * from workInfo + +``` + -- Gitee