From 1e715439ae7a2129fbbf67d0381ae2e9c1316f71 Mon Sep 17 00:00:00 2001 From: xiaojiuxu <2997735823@qq.com> Date: Tue, 13 Apr 2021 13:53:53 +0800 Subject: [PATCH 1/2] sda --- .../\345\217\266\347\234\237/NBA.sql" | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 "NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" diff --git "a/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" "b/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" new file mode 100644 index 0000000..5b4f869 --- /dev/null +++ "b/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" @@ -0,0 +1,137 @@ +use master +go + +create database NBA +on +( + name='NBA', + filename='D:\NBA.mdf', + size=5, + maxsize=50, + filegrowth=10% +) +log on +( + name='NBA_log', + filename='D:\NBA_log.ldf', + size=5, + maxsize=50, + filegrowth=10% +) +go + +use NBA +go + +create table UsersInfo +( + UsersId int primary key identity not null, --编号 + UsersName varchar(20) not null , --名字 + UsersSex varchar(2) , --性别 + jingli int not null , --经历 + Team varchar(20) not null , --队伍 +) +go + +create table Team +( + TeamId int primary key identity not null , --编号 + reamName varchar(20) not null , --名字 + Competition varchar(20) check(Competition in('东部','西部'))not null ,--赛区 + victory int not null , --胜场 + coach varchar(20) not null , --教练 +) +go + +create table Game +( + GameId int primary key identity not null , --编号 + TeamId1 int references Team(TeamId) not null , --主场 + defen1 int not null, --得分 + TeamId2 int references Team(TeamId) not null , --客场 + defen2 int not null, --得分 + date date not null --日期 +) +go + +create table UsersData +( + UsersId int references UsersInfo(UsersId) not null,--球员编号 + TeamId int references Team(TeamId) not null , --队伍编号 + chuchang int not null , --出场次数 + mingzhong varchar(10) not null , --命中率 + trisection varchar(10) not null , --三分命中率 + faqiu varchar(10) not null , --罚球率 + lanban float not null , --篮板 + zhugong float not null , --助攻 + defeng float not null , --得分 + qiangduan float not null , --抢断 + gaimao float not null , --盖帽 +) +go + +create table champion +( + TeamId int references Team(TeamId) not null , --队伍编号 + Mvp nvarchar(20) not null, --球员编号 + duoguan int not null, --那一年夺冠 + victory int not null , --胜场 + failing int not null , --负场 +) +go + +insert into UsersInfo + select '勒布朗-詹姆斯','男','17','湖人' union + select '贾里德-杜德利 ','男','13','湖人' union + select '扬尼斯-阿德托昆博 ','男','7','雄鹿' union + select '布鲁克-洛佩兹','男','12','雄鹿' union + select '斯蒂芬-库里 ','男','11','勇士' union + select '克雷-汤普森','男','8','勇士' union + select '凯文-杜兰特','男','12','篮网' union + select '詹姆斯-哈登 ','男','11','篮网' union + select '科怀-莱昂纳德 ','男','9','快船' union + select '拉简-朗多 ','男','14','快船' +go + +insert into Team + select '湖人','西部','32','弗兰克-沃格尔' union + select '雄鹿','东部','32','迈克-布登霍尔泽' union + select '勇士','西部','24','史蒂夫-科尔' union + select '篮网','东部','36','史蒂夫-纳什' union + select '快船','西部','34','泰伦-卢' +go + +insert into Game + select '4','138','5','99','2020-12-26 03:30:00' union + select '1','87','2','81','2020-12-12 11:00:00' union + select '1','131','2','106','2020-12-14 09:30:00' union + select '3','125','5','99','2020-12-23 08:00:00' union + select '1','109','2','116','2020-12-23 11:00:00' +go + +insert into UsersData + select '1','4','32','53.0','44.3','87.3','7.6','5.2','28.3','0.6','1.0' union + select '2','1','23','54.0','48.2','86.3','7.3','5.1','28.6','0.4','1.1' union + select '3','3','20','53.0','44.3','87.3','7.3','5.3','28.4','0.7','1.4' union + select '4','2','36','51.0','44.6','86.2','8.1','5.5','28.4','0.8','1.0' union + select '5','5','40','54.0','46.2','76.5','7.4','6.5','28.4','0.6','1.3' union + select '6','2','41','54.5','44.2','84.6','8.1','5.6','28.6','0.7','1.5' union + select '7','1','41','51.3','36.8','70.3','7.9','7.9','25.4','1','0.6' union + select '8','5','43','48.1','40.8','92.5','5.5','6','29.7','1.3','0.1' union + select '9','4','45','56.5','30.2','68.7','11.4','6.2','28.8','1.1','1.3' union + select '10','3','42','46.3','35.8','87.0','8','10.9','25.2','1.2','0.7' +go + +insert into champion + select '1','沙奎尔·奥尼尔','2000','4','2' union + select '1','沙奎尔·奥尼尔','2001','4','1' union + select '1','沙奎尔·奥尼尔','2002','4','0' union + select '1','科比-布莱恩特','2008','4','1' union + select '1','科比-布莱恩特','2009','4','3' +go + +select * from UsersInfo +select * from Team +select * from Game +select * from UsersData +select * from champion \ No newline at end of file -- Gitee From f33dfca711d7ce5586159e896b9c2afbd8ba33ff Mon Sep 17 00:00:00 2001 From: xiaojiuxu <2997735823@qq.com> Date: Tue, 13 Apr 2021 14:59:26 +0800 Subject: [PATCH 2/2] sdaf --- .../\345\217\266\347\234\237/NBA.sql" | 107 +++++++----------- 1 file changed, 42 insertions(+), 65 deletions(-) diff --git "a/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" "b/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" index 5b4f869..8c3e62d 100644 --- "a/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" +++ "b/NBA\344\275\234\344\270\232/\345\217\266\347\234\237/NBA.sql" @@ -1,86 +1,69 @@ use master go -create database NBA -on -( - name='NBA', - filename='D:\NBA.mdf', - size=5, - maxsize=50, - filegrowth=10% -) -log on -( - name='NBA_log', - filename='D:\NBA_log.ldf', - size=5, - maxsize=50, - filegrowth=10% -) +create database NBADate go use NBA go -create table UsersInfo +create table Team ( - UsersId int primary key identity not null, --编号 - UsersName varchar(20) not null , --名字 - UsersSex varchar(2) , --性别 - jingli int not null , --经历 - Team varchar(20) not null , --队伍 + TeamId int primary key identity not null , + reamName varchar(20) not null , + victory int not null , + coach varchar(20) not null ) go -create table Team +create table UsersInfo ( - TeamId int primary key identity not null , --编号 - reamName varchar(20) not null , --名字 - Competition varchar(20) check(Competition in('东部','西部'))not null ,--赛区 - victory int not null , --胜场 - coach varchar(20) not null , --教练 + UsersId int primary key identity not null, + UsersName varchar(20) not null , + UsersSex varchar(2) , + jingli int not null , + Team varchar(20) ) go -create table Game +create table UsersData ( - GameId int primary key identity not null , --编号 - TeamId1 int references Team(TeamId) not null , --主场 - defen1 int not null, --得分 - TeamId2 int references Team(TeamId) not null , --客场 - defen2 int not null, --得分 - date date not null --日期 + UsersId int references UsersInfo(UsersId) not null, + TeamId int references Team(TeamId) not null , + chuchang int not null , + mingzhong varchar(10) not null , + trisection varchar(10) not null , + faqiu varchar(10) not null , + lanban float not null , + zhugong float not null , + defeng float not null , + qiangduan float not null , + gaimao float not null ) go -create table UsersData +create table Game ( - UsersId int references UsersInfo(UsersId) not null,--球员编号 - TeamId int references Team(TeamId) not null , --队伍编号 - chuchang int not null , --出场次数 - mingzhong varchar(10) not null , --命中率 - trisection varchar(10) not null , --三分命中率 - faqiu varchar(10) not null , --罚球率 - lanban float not null , --篮板 - zhugong float not null , --助攻 - defeng float not null , --得分 - qiangduan float not null , --抢断 - gaimao float not null , --盖帽 + GameId int primary key identity not null , + TeamId1 int references Team(TeamId) not null , + defen1 int not null, + TeamId2 int references Team(TeamId) not null , + defen2 int not null, + date date not null ) go create table champion ( - TeamId int references Team(TeamId) not null , --队伍编号 - Mvp nvarchar(20) not null, --球员编号 - duoguan int not null, --那一年夺冠 - victory int not null , --胜场 - failing int not null , --负场 + TeamId int references Team(TeamId) not null , + Mvp nvarchar(20) not null, + duoguan int not null, + victory int not null , + failing int not null ) go -insert into UsersInfo +insert into UsersInfo select '勒布朗-詹姆斯','男','17','湖人' union select '贾里德-杜德利 ','男','13','湖人' union select '扬尼斯-阿德托昆博 ','男','7','雄鹿' union @@ -94,11 +77,11 @@ insert into UsersInfo go insert into Team - select '湖人','西部','32','弗兰克-沃格尔' union - select '雄鹿','东部','32','迈克-布登霍尔泽' union - select '勇士','西部','24','史蒂夫-科尔' union - select '篮网','东部','36','史蒂夫-纳什' union - select '快船','西部','34','泰伦-卢' + select '湖人','32','弗兰克-沃格尔' union + select '雄鹿','32','迈克-布登霍尔泽' union + select '勇士','24','史蒂夫-科尔' union + select '篮网','36','史蒂夫-纳什' union + select '快船','34','泰伦-卢' go insert into Game @@ -129,9 +112,3 @@ insert into champion select '1','科比-布莱恩特','2008','4','1' union select '1','科比-布莱恩特','2009','4','3' go - -select * from UsersInfo -select * from Team -select * from Game -select * from UsersData -select * from champion \ No newline at end of file -- Gitee