diff --git "a/19\351\231\210\345\277\227\346\242\201/2022-09-04 (2).png" "b/19\351\231\210\345\277\227\346\242\201/2022-09-04 (2).png" new file mode 100644 index 0000000000000000000000000000000000000000..4f945a4b3d77d275e33209c9da8431e6ad8b746c Binary files /dev/null and "b/19\351\231\210\345\277\227\346\242\201/2022-09-04 (2).png" differ diff --git "a/19\351\231\210\345\277\227\346\242\201/2022-09-04 (3).png" "b/19\351\231\210\345\277\227\346\242\201/2022-09-04 (3).png" new file mode 100644 index 0000000000000000000000000000000000000000..40459f0fb69023efdce812a045c8c72d9a74080a Binary files /dev/null and "b/19\351\231\210\345\277\227\346\242\201/2022-09-04 (3).png" differ diff --git "a/19\351\231\210\345\277\227\346\242\201/DBTEST.sql" "b/19\351\231\210\345\277\227\346\242\201/DBTEST.sql" new file mode 100644 index 0000000000000000000000000000000000000000..d7ed797e53998f8be51c22d842bc73109f5aca9a --- /dev/null +++ "b/19\351\231\210\345\277\227\346\242\201/DBTEST.sql" @@ -0,0 +1,303 @@ +if exists(select * from sys.databases where name='DBTEST') +drop database DBTEST; +go + +create database DBTEST; +go + +use DBTEST; +go + +--创建部门表 +create table Department +( + --创建部门编号;int代表整数类型;primary key代表主键;identity(1,1)代表从1开始步长为1自增长; + DepartmentId int primary key identity(1,1), + --创建部门名称;nvarchar(50)代表长度50的字符串;not null代表不能为空; + DepartmentName nvarchar(50) not null, + --创建部门描述;text代表长文本; + DepartmentRemark text +); +go + +--创建职级表,rank为系统关键字,此处使用[]代表自定义名字,而非系统关键字 +create table [Rank] +( + RankId int primary key identity(1,1), + RankName nvarchar(50) not null, + RankRemark text +); +go + +--创建员工信息表 +create table People +( + PeopleId int primary key identity(1,1), + --references代表外键引用,此字段必须符合与其它表的外键约束 + DepartmentId int references Department(DepartmentId) not null, + RankId int references [Rank](RankId) not null, + PeopleName nvarchar(50) not null, + --default代表字段默认值; check可以规定字段值的约束条件; + PeopleSex nvarchar(1) default('男') check(PeopleSex='男' or PeopleSex='女') not null, + PeopleBirth datetime not null, + PeopleSalary decimal(12,2) check(PeopleSalary>= 1000 and PeopleSalary <= 100000) not null, + --unique代表唯一约束,为数据提供唯一性保证; + PeoplePhone nvarchar(20) unique not null, + PeopleAddress nvarchar(100), + --datetime和smalldatetime都可以表示时间类型,getdate()用于获取系统当前时间 + PeopleAddTime smalldatetime default(getdate()) +); +go + + + +------------------------------插入数据部分------------------------------ +--部门表插入数据 +insert into Department values('行政部','公司主管行政工作的部门'); +go + +--一次性插入多条数据 +insert into Department(DepartmentName,DepartmentRemark) +select '市场部','吹牛的部门' union +select '产品部','天马星空的部门' union +select '总经办','都是领导的部门' ; +go + +-------职级表插入数据 +insert into [Rank](RankName,RankRemark) +values('初级','辅助其他人完成任务') +insert into [Rank](RankName,RankRemark) +values('中级','具备独立处理事务的能力') +insert into [Rank](RankName,RankRemark) +values('高级','具备可以带动全场节奏的能力'); +go + +---------向员工表插入数据 +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,3,'刘备','男','1984-7-9',20000,'13554785452','成都',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,2,'孙尚香','女','1987-7-9',15000,'13256854578','荆州',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,1,'关羽','男','1988-8-8',12000,'13985745871','荆州',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,1,'张飞','男','1990-8-8',8000,'13535987412','宜昌',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,3,'赵云','男','1989-4-8',9000,'13845789568','宜昌',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,3,'马超','男','1995-4-8',9500,'13878562568','香港',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,2,'黄盖','男','1989-4-20',8500,'13335457412','武汉',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,1,'貂蝉','女','1989-4-20',6500,'13437100050','武汉',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,2,'曹操','男','1987-12-20',25000,'13889562354','北京',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,3,'许褚','男','1981-11-11',9000,'13385299632','北京',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,1,'典韦','男','1978-1-13',8000,'13478545263','上海',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,1,'曹仁','男','1998-12-12',7500,'13878523695','深圳',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,3,'孙坚','男','1968-11-22',9000,'13698545841','广州',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,3,'孙策','男','1988-1-22',11000,'13558745874','深圳',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,2,'孙权','男','1990-2-21',12000,'13698745214','深圳',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,2,'大乔','女','1995-2-21',13000,'13985478512','上海',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,1,'小乔','女','1996-2-21',13500,'13778787874','北京',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,2,'周瑜','男','1992-10-11',8000,'13987455214','武汉',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(2,3,'鲁肃','男','1984-9-10',5500,'13254785965','成都',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(3,3,'吕蒙','男','1987-5-19',8500,'13352197364','成都',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,1,'陆逊','男','1996-5-19',7500,'13025457392','南京',getdate()) + +insert into People(DepartmentId,RankId,PeopleName,PeopleSex,PeopleBirth, +PeopleSalary,PeoplePhone,PeopleAddress,PeopleAddTime) +values(1,2,'太史慈','男','1983-6-1',7500,'13077778888','上海',getdate()) + + +---查询 +select * from Department +select * from [Rank] +select * from People + +--1. 根据指定列(姓名,性别,月薪,电话)查询性别为女的员工信息,并自定义中文列名 +select PeopleName 姓名,PeopleSex 性别,PeopleSalary 月薪,PeoplePhone 电话 from People where PeopleSex = '女' +--2. 查询月薪大于等于10000 的员工信息( 单条件 ) +select * from People where PeopleSalary>=10000 +--3. 查询月薪大于等于10000 的女员工信息(多条件) +select * from People where PeopleSalary>=10000 and PeopleSex = '女' +--4. 显示出出身年月在1980-1-1之后,而且月薪大于等于10000的女员工信息。 +select * from People where PeopleBirth>='1980-1-1' and PeopleSalary>=10000 +--5. 显示出月薪大于等于15000 的员工,或者月薪大于等于8000的女员工信息。 +select * from People where PeopleSalary>=15000 or (PeopleSalary >=8000 and PeopleSex = '女') +--6. 查询月薪在10000-20000 之间员工信息( 多条件 ) +select * from People where PeopleSalary between 10000 and 20000 +--7. 查询出地址在北京或者上海的员工信息 +select * from People where PeopleAddress ='北京' or PeopleAddress ='上海' +--8. 查询所有员工信息(根据工资排序,降序排列) +select * from People order by PeopleSalary desc +--9. 显示所有的员工信息,按照名字的长度进行倒序排列 +select * from People order by len(PeopleName) desc +--10. 查询工资最高的5个人的信息 +select top 5 * from People order by PeopleSalary desc +--11. 查询工资最高的10%的员工信息 +select top 10 percent * from People order by PeopleSalary +--12. 查询出地址没有填写的员工信息 +select * from People where PeopleAddress is null +--13. 查询出地址已经填写的员工信息 +select * from People where PeopleAddress is not null +--14. 查询所有的80后员工信息 +select * from People where PeopleBirth >='1980-1-1' +--15. 查询年龄在30-40 之间,并且工资在15000-30000 之间的员工信息 +select * from People where (PeopleSalary between 15000 and 30000) +--16. 查询出巨蟹 6.22--7.22 的员工信息 +select * from People where (month(PeopleBirth)=6 and day(PeopleBirth)>=22) or (month(PeopleBirth)=7 and day(PeopleBirth)<=22) +--17. 查询工资比赵云高的人 +select PeopleName from People where PeopleSalary >(select PeopleSalary from People where PeopleName = '赵云') +--18. 查询出和赵云在同一个城市的人 +select PeopleName from People where PeopleAddress = (select PeopleAddress from People where PeopleName = '赵云') + +--19. 查询出生肖为鼠的人员信息 +select * from People + where year(PeopleBirth)%12=4 +--20. 查询所有员工信息,添加一列显示属相(鼠,牛,虎,兔,龙,蛇,马,羊,猴,鸡,狗,猪) + + +--1. 查询姓刘的员工信息 +select * from People where PeopleName like'刘%' +--2. 查询名字中含有 " 尚 " 的员工信息 +select * from People where PeopleName like'%尚%' +--3. 显示名字中含有“尚”或者“史”的员工信息 +select * from People where PeopleName like'%尚%' or PeopleName like'%史%' +--4. 查询姓刘的员工,名字是2个字 +select * from People where PeopleName like'刘_' +--5. 查询出名字最后一个字是香,名字一共三个字的员工信息 +select * from People where PeopleName like'__香' +--6. 查询出电话号码开头138的员工信息 +select * from People where PeoplePhone like'138%' +--7. 查询出电话号码开头138的员工信息,第4位可能是7,可能8 ,最后一个号码是5 +select * from People where PeoplePhone like'138[7,8]%5' +--8. 查询出电话号码开头133的员工信息,第4位是2-5之间的数字 ,最后一个号码不是2和3 +select * from People where PeoplePhone like'133[2-5]%[^2-3]' + +--1. 求员工总人数 +select count(PeoplePhone) 总人数 from People +--2. 求最大值,求最高工资 +select max(PeopleSalary) 最高工资 from People +--3. 求最小值,求最小工资 +select min(PeopleSalary) 最小工资 from People +--4. 求和,求所有员工的工资总和 +select sum(PeopleSalary) 工资总和 from People +--5. 求平均值,求所有员工的平均工资 +select avg(PeopleSalary) 平均工资 from People +--6. 求数量,最大值,最小值,总和,平均值,在一行显示 +select count(PeoplePhone) 总人数 , max(PeopleSalary) 最高工资 , min(PeopleSalary) 最小工资 ,avg(PeopleSalary) 平均工资 from People +--7. 查询出武汉地区的员工人数,总工资,最高工资,最低工资和平均工资 +select PeopleAddress 地区,count(PeoplePhone) 总人数 , max(PeopleSalary) 最高工资 , min(PeopleSalary) 最小工资 ,avg(PeopleSalary) 平均工资 from People +where PeopleAddress = '武汉' +group by PeopleAddress +--8. 求出工资比平均工资高的人员信息 +select * from People where PeopleSalary>(select avg(PeopleSalary) from People) +--9. 求数量,年龄最大值,年龄最小值,年龄总和,年龄平均值,在一行显示 +select count(*) 总人数 , max (year(getdate())-year(PeopleBirth)) 最大, min (year(getdate())-year(PeopleBirth)) 最小 ,avg (year(getdate())-year(PeopleBirth)) 平均 from People +--10. 计算出月薪在10000 以上的男性员工的最大年龄,最小年龄和平均年龄 +select max(year(getdate())-year(PeopleBirth))最高 , min(year(getdate())-year(PeopleBirth)) 最小 ,avg(year(getdate())-year(PeopleBirth)) 平均 from People +where PeopleSex ='男' and PeopleSalary>10000 +--11. 统计出所在地在“武汉或上海”的所有女员工数量以及最大年龄,最小年龄和平均年龄 +select max(year(getdate())-year(PeopleBirth)) 最高 , min(year(getdate())-year(PeopleBirth)) 最小 ,avg(year(getdate())-year(PeopleBirth)) 平均 from People +where PeopleSex ='女' and PeopleAddress ='武汉' or PeopleAddress ='上海' +--12. 求出年龄比平均年龄高的人员信息 +select * from People where year(getdate())-year(PeopleBirth) >(select avg(year(getdate())-year(PeopleBirth)) from People) + +select * from Department +select * from [Rank] +select * from People + + +--1. 根据员工所在地区分组统计员工人数 ,员工工资总和 ,平均工资,最高工资和最低工资 +select PeopleAddress , count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +group by PeopleAddress +--2. 根据员工所在地区分组统计员工人数,员工工资总和,平均工资,最高工资和最低工资,1985 年及以后出身的员工不参与统计。 +select PeopleAddress , PeopleBirth,count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +where PeopleBirth <='1985-1-1' +group by PeopleAddress,PeopleBirth +--3. 根据员工所在地区分组统计员工人数,员工工资总和,平均工资,最高工资和最低工资,要求筛选出员工人数至少在2人及以上的记录,并且1985年及以后出身的员工不参与统计。 +select PeopleAddress ,count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +where PeopleBirth <='1985-1-1' +group by PeopleAddress +having count(*)>=2 + +--1. 查询出武汉地区所有的员工信息,要求显示部门名称以及员工的详细资料 +select * from People +inner join Department on Department.DepartmentId = People.DepartmentId +where PeopleAddress = '武汉' +--2. 查询出武汉地区所有的员工信息,要求显示部门名称,职级名称以及员工的详细资料 +select * from People +inner join Department on Department.DepartmentId = People.DepartmentId +inner join Rank on Rank.RankId = People.RankId +where PeopleAddress = '武汉' +--3. 根据部门分组统计员工人数,员工工资总和,平均工资,最高工资和最低工资。 +select DepartmentId,count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +group by DepartmentId +--4. 根据部门分组统计员工人数,员工工资总和,平均工资,最高工资和最低工资,平均工资在10000 以下的不参与统计,并且根据平均工资降序排列。 +select DepartmentName,count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +left join Department on Department.DepartmentId = People.DepartmentId +group by Department.DepartmentId,DepartmentName +having avg(PeopleSalary) >=10000 +order by avg(PeopleSalary) desc +--5. 根据部门名称,然后根据职位名称,分组统计员工人数,员工工资总和,平均工资,最高工资和最低工资 +select DepartmentName,RankName,count(*) ,sum(PeopleSalary) 工资总和,avg(PeopleSalary) 平均工资,max(PeopleSalary)最高工资,min(PeopleSalary) 最低工资 from People +left join Rank on rank.RankId = People.RankId +left join Department on Department.DepartmentId = People.DepartmentId +group by Department.DepartmentId,DepartmentName,Rank.RankId,RankName + +select * from Department +select * from [Rank] +select * from People \ No newline at end of file diff --git "a/19\351\231\210\345\277\227\346\242\201/SQLQuery2.sql" "b/19\351\231\210\345\277\227\346\242\201/SQLQuery2.sql" new file mode 100644 index 0000000000000000000000000000000000000000..34e643f143c6b7f82bf4cae74d1f2164e1665ec6 --- /dev/null +++ "b/19\351\231\210\345\277\227\346\242\201/SQLQuery2.sql" @@ -0,0 +1,45 @@ +create database Bank +go +use Bank +go + +create table CcountInfo( + CcId int primary key identity(1,1), + CcName nvarchar(50), + CcBalance float not null, + CcPassWord int not null +) +insert into CcountInfo values('张三',263.03,21354) +create table CcountCard( + CardId int primary key identity(1,1), + CardNumber int not null, + CardDraw float not null, + CardBalance float not null, + CardPassWord int not null +) +insert into CcountCard values(22262,25623.23,568,2156) +create table CcountTrad( + CcountId int primary key identity(1,1), + CardNumber int not null, + CcountDraw float not null, + CcountBalance float not null, + CcountPassWord int not null +) +insert into CcountTrad values(65451,23.03,956.00,123456) +create table CcountTrader( + CcountId int primary key identity(1,1), + CardNumber int not null, + CardTrader int not null, +) +insert into CcountTrader values(96215,23151) +create table CcountCheck( + CcountId int primary key identity(1,1), + CardNumber nvarchar(50) check(CardNumber = '正常' or CardNumber = '挂失' or CardNumber = '冻结' or CardNumber = '注销') + ) + insert into CcountCheck values('正常') + + select * from CcountInfo + select * from CcountCard + select * from CcountTrad + select * from CcountTrader + select * from CcountCheck \ No newline at end of file diff --git "a/19\351\231\210\345\277\227\346\242\201/\347\254\224\350\256\260.md" "b/19\351\231\210\345\277\227\346\242\201/\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..f9d68a6ded9a02f1cb33fe41ad24ac7491b22be0 --- /dev/null +++ "b/19\351\231\210\345\277\227\346\242\201/\347\254\224\350\256\260.md" @@ -0,0 +1,139 @@ +1.--default浠h〃瀛楁榛樿鍊; check鍙互瑙勫畾瀛楁鍊肩殑绾︽潫鏉′欢; + PeopleSex nvarchar(1) default('鐢') check(PeopleSex='鐢' or PeopleSex='濂') not null, + +2.decimal: + +鈥 PeopleSalary decimal(12,2) check(PeopleSalary>= 1000 and PeopleSalary <= 100000) not null, +鈥 + +3.--unique浠h〃鍞竴绾︽潫锛屼负鏁版嵁鎻愪緵鍞竴鎬т繚璇; + PeoplePhone nvarchar(20) unique not null, + +4.--datetime鍜宻malldatetime閮藉彲浠ヨ〃绀烘椂闂寸被鍨嬶紝getdate()鐢ㄤ簬鑾峰彇绯荤粺褰撳墠鏃堕棿 + PeopleAddTime smalldatetime default(getdate()) + +5.鎻掑叆鏁版嵁 +insert into Department values('琛屾斂閮','鍏徃涓荤琛屾斂宸ヤ綔鐨勯儴闂'); + +6.between ...and ... + +select * from People where PeopleSalary between 10000 and 20000 + +7.闄嶅簭\鍗囧簭 + +select * from People order by PeopleSalary desc \ asc + + + +8.妯$硦鏌ヨ like + +妯$硦鏌ヨ +%锛氫唬琛ㄥ尮閰0涓瓧绗︺1涓瓧绗︽垨澶氫釜瀛楃銆 +_锛氫唬琛ㄥ尮閰嶆湁涓斿彧鏈1涓瓧绗︺ +[]锛氫唬琛ㄥ尮閰嶈寖鍥村唴 +[^]锛氫唬琛ㄥ尮閰嶄笉鍦ㄨ寖鍥村唴 + +1.)鏌ヨ濮撳垬 + +select * from People where PeopleName like'鍒%' + +2.)鍚湁鈥滃皻鈥濇垨鑰呪滃彶鈥濈殑鍛樺伐淇℃伅 + +where PeopleName like'%灏%' or PeopleName like'%鍙%' + +3.)鍚嶅瓧鏄2涓瓧 + +where PeopleName like'鍒榑' + +4.)鍚嶅瓧涓鍏变笁涓瓧鐨勫憳宸ヤ俊鎭 + +where PeopleName like'__棣' + +5.)寮澶138鐨勫憳宸ヤ俊鎭 + +where PeoplePhone like'138%' + +6.)寮澶138鐨勫憳宸ヤ俊鎭,绗4浣嶅彲鑳芥槸7锛屽彲鑳8 锛屾渶鍚庝竴涓彿鐮佹槸5 + +where PeoplePhone like'138[7,8]%5' + +7.)寮澶133鐨勫憳宸ヤ俊鎭,绗4浣嶆槸2-5涔嬮棿鐨勬暟瀛 锛屾渶鍚庝竴涓彿鐮佷笉鏄2鍜3 + +where PeoplePhone like'133[2-5]%[^2-3] + + + +9.闄愬埗闀垮害锛歭en +userName varchar(20) unique not null check(len(userName)>4), + +10.round(num,len,[type]) +鍏朵腑: +num琛ㄧず闇瑕佸鐞嗙殑鏁板瓧锛宭en琛ㄧず闇瑕佷繚鐣欑殑闀垮害锛宼ype澶勭悊绫诲瀷(0鏄粯璁ゅ间唬琛ㄥ洓鑸嶄簲鍏ワ紝闈0浠h〃鐩存帴鎴彇) + +11.year(getdate()) 鑾峰彇褰撳墠鏃堕棿 + +12.椤哄簭锛 + +鈥 select + +鈥 left jion + +鈥 group by + +鈥 having + +鈥 order by desc/asc + + + +13.锛氳寖寮 + +**绗竴鑼冨紡锛1NF锛夛細** + +![img](https://img2020.cnblogs.com/blog/944376/202104/944376-20210429144806987-1479266927.png) + + +銆銆鍒1鍞竴纭畾鍒2, 鍒3, 鍒4, ...锛屽嵆鍒2, 鍒3, 鍒4, ...涓嶈兘鍐嶅垎瑁傚嚭鍏跺畠鍒椼 + +銆銆鍋囪鏈夊叧绯绘ā寮忓垪1: 璁㈠崟鍚; 鍒2: 鍟嗗搧銆備竴涓鍗曚笅鍙互鏈夊涓晢鍝侊紝鍗冲垪2: 鍟嗗搧鍙互鍒嗚鎴愬晢鍝丄, 鍟嗗搧B, 鍟嗗搧C, ...锛屾墍浠ュ垪1: 璁㈠崟鍚; 鍒2: 鍟嗗搧杩欐牱鐨勫叧绯绘ā寮忎笉绗﹀悎绗竴鑼冨紡銆 + +# 銆绗簩鑼冨紡锛2NF锛夛細 + +![img](https://img2020.cnblogs.com/blog/944376/202104/944376-20210429145214099-1241070153.png) + + + + + + + + + + +鈥冣冩弧瓒2NF鐨勫墠鎻愭槸蹇呴』婊¤冻1NF銆 + +銆銆姝ゅ锛屽叧绯绘ā寮忛渶瑕佸寘鍚袱閮ㄥ垎鍐呭銆備竴鏄繀椤绘湁涓涓紙鍙婁互涓婏級涓婚敭锛涗簩鏄病鏈夊寘鍚湪涓婚敭涓殑鍒楀繀椤诲叏閮ㄤ緷璧栦簬鍏ㄩ儴涓婚敭锛岃屼笉鑳藉彧渚濊禆浜庝富閿殑涓閮ㄥ垎鑰屼笉渚濊禆鍏ㄩ儴涓婚敭銆 + +鈥冣冨畾涔夊惉璧锋潵鏈夌偣缁曪紝涓嶆厡锛岀洿鎺ョ湅鍥撅紝鍙湁鍏ㄩ儴鐨勯潪涓婚敭鍒椾緷璧栦簬鍏ㄩ儴涓婚敭锛屾墠婊¤冻绗簩鑼冨紡銆 + +銆銆**绗笁鑼冨紡锛3NF锛夛細** + +![img](https://img2020.cnblogs.com/blog/944376/202104/944376-20210429145526908-1013297767.png) + + + + + + + + +銆銆婊¤冻3NF鐨勫墠鎻愭槸蹇呴』婊¤冻2NF銆 + +銆銆鍙﹀鍏崇郴妯″紡鐨勯潪涓婚敭鍒楀繀椤荤洿鎺ヤ緷璧栦簬涓婚敭锛屼笉鑳藉瓨鍦ㄤ紶閫掍緷璧栥傚嵆涓嶈兘瀛樺湪锛氶潪涓婚敭鍒梞鏃緷璧栦簬鍏ㄩ儴涓婚敭锛屽張渚濊禆浜庨潪涓婚敭鍒梟鐨勬儏鍐点 + +銆銆瀹氫箟鍚捣鏉ヨ繕鏄湁鐐圭粫锛屼笉鎱岋紝鐩存帴鐪嬪浘锛屽彧瑕侀潪涓婚敭鍐呴儴瀛樺湪浼犻掍緷璧栵紝灏变笉婊¤冻绗笁鑼冨紡銆 + +銆銆鍋囪瀛樺湪鍏崇郴妯″紡涓婚敭1: 璇剧▼缂栧彿; 鍒1: 鏁欏笀鍚; 鍒2: 鏁欏笀瀹跺涵鍦板潃銆傛樉鐒舵弧瓒崇涓鑼冨紡鍜岀浜岃寖寮忥紝浣嗘槸鏁欏笀瀹跺涵鍦板潃浼犻掍緷璧栦簬鏁欏笀鍚嶏紝鎵浠ヤ笉婊¤冻绗笁鑼冨紡銆 + + + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 857e214f8a49e71d1e4f543c63859385eb493ba1..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# SQL杩涢樁 - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)