diff --git "a/10\344\275\231\351\207\221\346\230\237/\345\273\272\345\272\223\345\273\272\350\241\250\347\273\203\344\271\240.sql" "b/10\344\275\231\351\207\221\346\230\237/\345\273\272\345\272\223\345\273\272\350\241\250\347\273\203\344\271\240.sql" new file mode 100644 index 0000000000000000000000000000000000000000..ab10f9015b9cfaf3bb0005078e7ac45fffebf87d --- /dev/null +++ "b/10\344\275\231\351\207\221\346\230\237/\345\273\272\345\272\223\345\273\272\350\241\250\347\273\203\344\271\240.sql" @@ -0,0 +1,54 @@ +create database DBTEST +go +use DBTEST +go +--部门信息表 +create table sectionInfo( +sectionID int primary key identity(1,1),--部门编号 +sectionName varchar(10) not null --部门名称 +) +go +insert sectionInfo +values('人事部'), + ('行政部'), + ('财会部'), + ('安全部'), + ('销售部') +go +--员工信息表 +create table userInfo( +userNo int primary key identity(1,1) not null,--员工编号 +userName varchar(10) unique not null check(len(userName)>4),--员工姓名 +userSex varchar(2) not null check(userSex='男'or userSex='女'),--员工性别 +userAge int not null check(userAge>=1 and userAge<=100),--员工年龄 +userAddress varchar(50) default('湖北'),--员工地址 +userSection int references sectionInfo(sectionID)--员工部门 +) +go +insert userInfo +values('小小小灿芳','男',20,'福建',2), + ('两年半的羿','男',20,'福建',4), + ('羿的铁杆粉','男',20,'福建',5) +insert userInfo(userName,userSex,userAge,userSection) +values('asdzxc','男',20,,2), + ('aaaaaaaaaa','男',20,'福建',1) +go +--员工考勤表 +create table workInfo( +workId int primary key identity(1,1) not null,--考勤编号 +userId int references userInfo(userNo) not null,--考勤员工 +workTime datetime not null,--考勤时间 +workDescription varchar(40) not null check(workDescription='迟到'or workDescription='早退'or workDescription='旷工' +or workDescription='病假' or workDescription='事假')--考勤说明 +) +go +insert workInfo +values(2,'2022-8-29 10:44:00','事假'), + (3,'2022-8-29 10:32:50','迟到'), + (1,'2022-8-29 10:42:10','早退'), + (5,'2022-8-29 10:01:30','旷工'), + (4,'2022-8-29 10:55:16','病假') +go +select * from sectionInfo +select * from userInfo +select * from workInfo \ No newline at end of file