NBA球員數(shù)據(jù)管理系統(tǒng)_第1頁
NBA球員數(shù)據(jù)管理系統(tǒng)_第2頁
NBA球員數(shù)據(jù)管理系統(tǒng)_第3頁
NBA球員數(shù)據(jù)管理系統(tǒng)_第4頁
NBA球員數(shù)據(jù)管理系統(tǒng)_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、數(shù)據(jù)庫課程設計題目:NBA球員數(shù)據(jù)管理系統(tǒng)學生姓名唐力班級網(wǎng)絡101學生學號2010121038指導老師方睿1 引言31.1 NBA球員數(shù)據(jù)管理系統(tǒng)簡介:3本系統(tǒng)的主要工作:32本系統(tǒng)需求分析及系統(tǒng)運行環(huán)境:32.1 背景:3系統(tǒng)需求規(guī)格說明:3NBA球員管理系統(tǒng)具備的主要功能:4流程圖:62.5 NBA球員管理系統(tǒng)的實體分析:6系統(tǒng)運行環(huán)境:93數(shù)據(jù)庫分析:93.1 數(shù)據(jù)庫的創(chuàng)建:9數(shù)據(jù)庫表的創(chuàng)建:9表的約束:123.4 索引:133.5數(shù)據(jù)插入:133.6數(shù)據(jù)庫表的查詢用法:163.6.1數(shù)據(jù)庫表多條件查詢:163.6.2數(shù)據(jù)庫表排序查詢:163.6.3數(shù)據(jù)庫表嵌套查詢:173.6.4數(shù)據(jù)

2、庫表模糊查詢:173.6.5數(shù)據(jù)庫表的修改或刪除:173.6.6數(shù)據(jù)庫表分組查詢:184數(shù)據(jù)庫的高級編程:185系統(tǒng)的安全:205.1登錄服務器的賬號創(chuàng)建:205.2數(shù)據(jù)庫賬號創(chuàng)建:225.3角色及權限的分配:225.4數(shù)據(jù)庫的分離和附加,備份恢復:235.5數(shù)據(jù)庫導入和導出:256總結:267參考文獻:261 引言1.1 NBA球員數(shù)據(jù)管理系統(tǒng)簡介:本程序設計與實現(xiàn)開發(fā)出來的是一個用SQL Server 2008軟件編寫而成的NBA球員數(shù)據(jù)管理系統(tǒng)。本文重點討論該系統(tǒng)的設計與實現(xiàn),系統(tǒng)通過代碼的方式寫成,通過測試與分析說明該系統(tǒng)可穩(wěn)定運行,具有一定程度的實現(xiàn)價值。1.2 本系統(tǒng)的主要工作:N

3、BA球員管理系統(tǒng)的主要任務是建立,維護用戶信息檔案,統(tǒng)計,更新現(xiàn)役NBA球員的數(shù)據(jù)信息,提供給用戶方便了解NBA球員。2 本系統(tǒng)需求分析及系統(tǒng)運行環(huán)境:2.1 背景:NBA是National Basketball Association的縮寫。成立于1946年6月6日。成立時叫BAA,即全美籃協(xié)會(Basketball Association of America),是由十一家冰球館體育館的老板為了讓體育館在冰球比賽以外的時間,不至于閑置而共同發(fā)起成立的。BAA成立時共11支球隊。1949年BAA吞并了當時的另外一個聯(lián)盟(NBL),并改名為NBA。直到現(xiàn)在聯(lián)盟共30支球隊。 近些年,姚明成功的

4、在NBA立足,成為世界巨星,且NBA也成功進入了中國這塊市場,中國很多球迷開始迷戀NBA ,而球迷們也對每支球隊的球員非常感興趣。 而開發(fā)的系統(tǒng)是統(tǒng)計了每個球員的年齡,位置,籍貫,身高,所在球隊,以及場均得分,場均助攻,場均籃板,每場比賽球員的各種數(shù)據(jù)統(tǒng)計,球員的日常生活信息等。 為廣大籃球fans提供了更為方便的去了解NBA以及各個球員,也讓球迷們對自己喜愛的球員有直觀的透徹的了解到他們的情況。2.2 系統(tǒng)需求規(guī)格說明:3 (1)系統(tǒng)管理員為球迷建立信息檔案,用戶進入系統(tǒng)前需身份驗證,用戶名、密碼輸入正確后方可進入系統(tǒng)。用戶分為管理員,球迷,他們分別擁有不同的使用權限和不同的功能。管理員擁有

5、最高權限和最大限度的功能。(2) 系統(tǒng)為球迷建立檔案,可按球迷ID或者名稱查詢,檔案主要包括球員ID,名字,居住地,年齡等。(3) 在系統(tǒng)中,管理員需要對球員數(shù)據(jù)隨時錄入,更新,維護,方便球迷得到球員最新動態(tài)的數(shù)據(jù)。(一般一輪比賽完就更新)(4)系統(tǒng)的客戶端在Windows平臺下運行,服務器可在Windows平臺或UNIX平臺下運行。系統(tǒng)需要有較好的安全性和可擴展性,并提供簡潔方便的圖形用戶界面。球迷流程管理員流程2.3 NBA球員管理系統(tǒng)具備的主要功能:本系統(tǒng)的主要功能如下:(1) 球迷信息管理:對球迷的基本信息(如ID,姓名,年齡,居住地等)進行錄入和修改。(2) 球員數(shù)據(jù)信息管理:對球員

6、的數(shù)據(jù)信息(如球員場均得分,場均籃板,場均助攻,場均搶斷,場均失誤等)錄入和更新。(3) 管理員信息管理:管理個人用戶信息的錄入和修改。(管理員只屬于重慶,北京,上海等城市)(4) 每支球隊信息管理:對球隊的數(shù)據(jù)信息(如球隊ID,球隊名,戰(zhàn)績等)錄入和更新。(5) 球員年齡信息管理:對球員年齡的數(shù)據(jù)信息(如球員ID,球員名,player20to30等)錄入和修改。(6) 球員號碼信息管理:對球員號碼信息管理(如player11to20,player20to40等)錄入和修改。(7) 球員信息管理:對球員信息(如年齡,資金,所在球隊,球員號碼等)進行錄入和修改。功能模塊如下:2.4 流程圖:球迷

7、數(shù)據(jù)錄入管理者登陸球迷登記表注冊登記表數(shù)據(jù)庫信息查詢要求信息瀏覽目錄業(yè)務流程圖2.5 NBA球員管理系統(tǒng)的實體分析:(1) 實體圖: (2)ER 圖2.5 系統(tǒng)運行環(huán)境: 本系統(tǒng)是運行在WindowsXP、Windows win7等操作系統(tǒng)環(huán)境;處理器型號及內存容量:內存>=256M;輸入及輸出設備的型號和數(shù)量,聯(lián)機或脫機:待定。3 數(shù)據(jù)庫分析:3.1 數(shù)據(jù)庫的創(chuàng)建:NBA球員數(shù)據(jù)管理系統(tǒng)數(shù)據(jù)庫的創(chuàng)建:CREATE DATABASE PlayerON PRIMARY(NAME=Player_Data,FILENAME='G:C數(shù)據(jù)庫作業(yè)Player_Data.MDF',S

8、IZE=10,MAXSIZE=UNLIMITED,FILEGROWTH=5)LOG ON(NAME=Player_Log,FILENAME='G:C數(shù)據(jù)庫作業(yè)Player_Data.LDF',SIZE=10,MAXSIZE=UNLIMITED,FILEGROWTH=10%)GO3.2 數(shù)據(jù)庫表的創(chuàng)建:(1)球員數(shù)據(jù)表:CREATE TABLE playerdata(playerIDchar(10) NOT NULL,playernamechar(25)NOT NULL,ppgfloatNOT NULL,rpgfloatNOT NULL,apgfloatNOT NULL,spgf

9、loatNOT NULL,bpgfloatNOT NULL,mpgfloatNOT NULL,FTfloatNOT NULL,FromthreefloatNOT NULL,jumpershotfloatNOT NULL,PRIMARY KEY (playerID,playername)(2)球員表: CREATE TABLE player(playerIDchar(10)NOT NULL,playernamechar(25)NOT NULL,playercapitalmoneyNOT NULL,playeragesmallintNOT NULL,teamnamechar(30)NOT NULL

10、,playerNOsmallintNOT NULL,teamIDchar(15)NOT NULL,PRIMARY KEY (playerID,playername)(3)球員號碼表:CREATE TABLE playernum(playerIDchar(10)NOT NULL,player1to20 char(25) NOT NULL,player20to40char(25) NOT NULL,player40upchar(25) NOT NULL,playernamechar(25)NOT NULL,CONSTRAINT pkplayernum PRIMARY KEY (playerID,p

11、layername),FOREIGN KEY (playername) REFERENCES scancategory(playername)(4)球員年齡表:CREATE TABLE playerage(playerIDchar(10) NOT NULL,playeraddsmallint NOT NULL,player20to23char(25) NOT NULL,player23to27char(25) NOT NULL,player27to32char(25) NOT NULL,player32upchar(25) NOT NULL,playernamechar(25)NOT NULL

12、,CONSTRAINT pkplayerage PRIMARY KEY (playerID,playername),FOREIGN KEY (playername) REFERENCES scancategory(playername)(5)每支球隊表:CREATE TABLEeveryteam(teamIDchar(15) NOT NULL,teamnamechar(30) NOT NULL,teamcapitalmoneyNOT NULL,combatgainsfloatNOT NULL,playernamechar(25)REFERENCES scancategory(playernam

13、e),CONSTRAINT pkeveryteam PRIMARY KEY (teamID)(6)管理員表:CREATE TABLE Administrator(ADMIDchar(10)NOT NULL,namechar(25)NOT NULL,agesmallintNOT NULL,sexchar(2)NOT NULL,citychar(15)NOT NULL CONSTRAINT chkcity CHECK(city IN ('chongqing','sichuan','beijing','shanghai','xi

14、anggang','aomen','taiwan','dalian'),PRIMARY KEY (ADMID,name)(7)登錄用戶表:CREATE TABLE Registrant(funIDchar(10)NOT NULL,lnamechar(25)NOT NULL,lkeychar(16)NOT NULL,agesmallintNOT NULL,sexchar(2)NOT NULL,lcitychar(15)NOT NULL CONSTRAINT chklcity CHECK (lcity IN ('chongqing&#

15、39;,'sichuan','beijing','shanghai','xianggang','aomen','taiwan','dalian'),PRIMARY KEY (funID,lname)(8)瀏覽目錄表:CREATE TABLE scancategory(playernamechar(25) NOT NULL,teamnamechar(30) NOT NULL,playeragesmallint NOT NULL,playerNOsmallintNOT NULL,PRIM

16、ARY KEY (playername)CREATE UNIQUE NONCLUSTERED INDEX idx_categoryON scancategory (playername)3.3 表的約束:(1) 檢查約束:管理員用戶表:CREATE TABLE Administrator(ADMIDchar(10)NOT NULL,namechar(25)NOT NULL,agesmallintNOT NULL,sexchar(2)NOT NULL,citychar(15)NOT NULL CONSTRAINT chkcity CHECK(city IN ('chongqing'

17、;,'sichuan','beijing','shanghai','xianggang','aomen','taiwan','dalian'),PRIMARY KEY (ADMID,name)CREATE TABLE Registrant(funIDchar(10)NOT NULL,lnamechar(25)NOT NULL,lkeychar(16)NOT NULL,agesmallintNOT NULL,sexchar(2)NOT NULL,lcitychar(15)NOT NUL

18、L CONSTRAINT chklcity CHECK (lcity IN ('chongqing','sichuan','beijing','shanghai','xianggang','aomen','taiwan','dalian'),PRIMARY KEY (funID,lname)(2) 外鍵約束:球員年齡信息表:CREATE TABLE playerage(playerIDchar(10) NOT NULL,playeraddsmallint NOT NU

19、LL,player20to23char(25) NOT NULL,player23to27char(25) NOT NULL,player27to32char(25) NOT NULL,player32upchar(25) NOT NULL,playernamechar(25)NOT NULL,CONSTRAINT pkplayerage PRIMARY KEY (playerID,playername),FOREIGN KEY (playername) REFERENCES scancategory(playername)CREATE TABLE playernum(playerIDchar

20、(25)NOT NULL,player1to20 char(25) NOT NULL,player20to40char(25) NOT NULL,player40upchar(25) NOT NULL,playernamechar(25)NOT NULL,CONSTRAINT pkplayernum PRIMARY KEY (playerID,playername),FOREIGN KEY (playername) REFERENCES scancategory(playername)(3) 主鍵約束:每支球隊信息表:CREATE TABLEeveryteam(teamIDchar(15) N

21、OT NULL,teamnamechar(30) NOT NULL,teamcapitalmoneyNOT NULL,combatgainsfloatNOT NULL,playernamechar(25)REFERENCES scancategory(playername),CONSTRAINT pkeveryteam PRIMARY KEY (teamID)3.4 索引:CREATE TABLE scancategory(playernamechar(25) NOT NULL,teamnamechar(30) NOT NULL,playeragesmallint NOT NULL,playe

22、rNOsmallintNOT NULL,PRIMARY KEY (playername)CREATE UNIQUE NONCLUSTERED INDEX idx_categoryON scancategory (playername):(1)目錄數(shù)據(jù)插入:INSERT scancategory(playername ,teamname ,playerNO,playerage)VALUES ('Tracy McGrady','Detroit Pistons',1,32),('Tayshaun Prince','Detroit Pistons

23、',22,31),('Richard Hamilton','Detroit Pistons',32,33),('Greg Monroe','Detroit Pistons',10,21),('Rodney Stuckey','Detroit Pistons',3,25),('Charlie Villanueva','Detroit Pistons',31,27),('Ben Gordon','Detroit Pistons',7

24、,28),('Jason Maxiell','Detroit Pistons',54,28),('Ben Wallace','Detroit Pistons',6,37),('Austin Daye','Detroit Pistons',5,23),('Kevin Martin','Houston Rockets',12,28),('Luis Scola','Houston Rockets',4,31),('Kyle Lowry

25、','Houston Rockets',7,25),('Chase Budinger','Houston Rockets',10,23),('Courtney Lee','Houston Rockets',5,26),('Chuck Hayes','Houston Rockets',44,28),('Goran Dragic','Houston Rockets',3,25),('Patrick Patterson','H

26、ouston Rockets',54,24),('Terrence Williams','Houston Rockets',1,24),('Hasheem Thabeet','Houston Rockets',32,24),('Kevin Durant','Oklahoma City Thunder',35,23),('Russell Westbrook','Oklahoma City Thunder',0,23),('James Harden'

27、;,'Oklahoma City Thunder','13',22),('(Serge Ibaka','Oklahoma City Thunder',9,22),('Thabo Sefolosha','Oklahoma City Thunder',2,27),('Kendrick Perkins','Oklahoma City Thunder',5,27),('Nazr Mohammed','Oklahoma City Thunder'

28、,8,34),('Eric Maynor','Oklahoma City Thunder',6,24),('Nate Robinson','Oklahoma City Thunder',3,27),('Nick Collison','Oklahoma City Thunder','4',31),('Derrick Rose','Chicago Bulls',1,23),('Luol Deng','Chicago Bulls

29、9;,9,26),('Carlos Boozer','Chicago Bulls',5,30),('Kyle Korver','Chicago Bulls','26',30),('Taj Gibson','Chicago Bulls',22,26),('Joakim Noah','Chicago Bulls',13,26),('Ronnie Brewer','Chicago Bulls',11,26),('C.J

30、. Watson','Chicago Bulls',32,27),('Keith Bogans','Chicago Bulls',6,31),('Omer Asik','Chicago Bulls',3,25),('Amare Stoudemire','New York Knicks',1,29),('Carmelo Anthony','New York Knicks',7,27),('Chauncey Billups',

31、9;New York Knicks',4,35),('Toney Douglas','New York Knicks',23,25),('Landry Fields','New York Knicks',6,23),('Shawne Williams','New York Knicks',3,25),('Bill Walker','New York Knicks',5,24),('Ronny Turiaf','New York Knic

32、ks',14,28),('Shelden Williams','New York Knicks',13,28),('Derrick Brown','New York Knicks',2,24)select *from scancategory(2)每支球隊插入:INSERT everyteam(teamID,combatgains ,teamcapital,teamname )VALUES (001,2500,'Houston Rockets'),(002,2650,'Chicago Bulls&#

33、39;),(003,2750,'Detroit Pistons'),(004,2700,'Oklahoma City Thunder'),(005,3200,'New York Knicks'),(006,2800,'Portland Trail Blazers')(3)球員數(shù)據(jù)插入:INSERT playerdata (playerID ,playername ,spg ,rpg ,ppg ,bpg ,apg ,mpg ,FT ,Fromthree ,jumpershot )VALUES ('a','Tr

34、acy McGrady',),('b','Thabo Sefolosha',),('c','Rodney Stuckey',),('d','Chauncey Billups',),('e','Austin Daye',),('f','Landry Fields',)(4) 球員號碼插入:INSERT playernum (playerID , player1to20 ,player20to40 ,player40up ,play

35、ername )VALUES ('a',1,0,0,'Tracy McGrady'),('b',2,0,0,'Thabo Sefolosha'),('c',3,0,0,'Rodney Stuckey'),('d',4,0,0,'Chauncey Billups'),('e',5,0,0,'Austin Daye'),('f',6,0,0,'Landry Fields')select *from playe

36、rnum(5) 球員插入:INSERT Player (playerID ,playername ,playerNO ,playerage ,playercapital ,teamID ,teamname )VALUES ('a','Tracy McGrady',1,32,249,003,'Detroit Pistons'),('b','Thabo Sefolosha',2,27,132,004,'Oklahoma City Thunder'),('c','Rodney St

37、uckey',3,25,142,003,'Detroit Pistons'),('d','Chauncey Billups',4,37,239,005,'New York Knicks'),('e','Austin Daye',5,23,47,003,'Detroit Pistons'),('f','Landry Fields',6,23,34,005,'New York Knicks')(6) 球員年齡插入:INSERT pl

38、ayerage (playerID ,playeradd,player20to23 ,player23to27 ,player27to32 ,player32up ,playername )VALUES ('a',0,0,0,32,0,'Tracy McGrady'),('b',0,0,27,0,0,'Thabo Sefolosha'),('c',0,0,25,0,0,'Rodney Stuckey'),('d',0,0,0,0,37,'Chauncey Billups

39、9;),('e',0,23,0,0,0,'Austin Daye'),('f',0,23,0,0,0,'Landry Fields')select *from playerage(7) 管理員插入:INSERT Administrator (ADMID ,age ,city ,name ,sex )VALUES ('aa',21,'chongqing','li','G'),('bb',22,'sichuan','tang'

40、;,'B'),('cc',23,'beijing','liyi','G')(8) 登錄用戶插入:INSERT Registrant (funID,age ,lcity ,lname ,sex ,lkey )VALUES ('aaa',20,'shanghai','tang','B','369258'),('bbb',21,'beijing','li','G','74

41、1852'),('ccc',22,'chongqing','liyi','G','123456')的查詢用法:多條件查詢:查詢球員年齡表(playerage)中年齡大于27且小于33球員:SELECT playername,playerID,player27to32 FROM playerage where player27to32 >27 AND player27to32 <33查詢球員球員號碼表(playernum)中號碼大于0小于5球員:SELECT playername,playerID

42、,player1to20 FROM playernum where player1to20 >0 AND player1to20 <5排序查詢:按球員號碼由大到小排序:SELECT playername,playerID,playercapital,teamname,teamID,playerage,playerNO FROM player ORDER BY playerNO desc嵌套查詢:按球員表(player)中年齡最大的球員:SELECT playername,playerID,teamname,teamID,playerNO FROM player WHERE play

43、erage =(SELECT MAX(playerage ) FROM player )模糊查詢:按球員表(player)中所在球隊為D開頭的查詢:SELECT playername,playerID,teamname,playerNO,teamID FROM player WHERE teamname like 'D%'的修改或刪除:修改管理員表中(name=tang)的修改,并加對年齡age+2:UPDATE Administrator SET age =age+2WHERE name='tang'SELECT *from Administrator(刪除R

44、egistrantd中的lcity為shanghai的用戶者)DELETE Registrant WHERE lcity ='shanghai'select *from Registrant刪除登錄用戶表中(lcity=shanghai)的刪除:DELETE Registrant WHERE lcity ='shanghai'select *from Registrant分組查詢:在球員數(shù)據(jù)表(playerdata)中搶斷(spg)大于1.0的查詢:SELECT playername,'搶斷大于1的球員'= MIN(spg) FROM playe

45、rdata GROUP BY playernameHAVING MIN(spg) >4 數(shù)據(jù)庫的高級編程:/*創(chuàng)建球員數(shù)據(jù)的視圖,場均得分(ppg)大于的球員的場均助攻(apg)加2*/CREATE VIEW vwplayerdataASSELECT playerID ,playername ,spg ,rpg ,ppg ,bpg ,apg ,mpg ,FT ,Fromthree ,jumpershot FROM playerdata WHERE ppg >20GOSELECT *FROM vwplayerdata UPDATE vwplayerdata SET apg =apg +2SELECT *FROM vwplayerdata 場均助攻(apg)加2之后:/*在表球員數(shù)據(jù)(playerdata)中,根據(jù)輸入球員名字,返回場均得分,場均助攻,場均籃板,場均搶斷,場均蓋帽。代碼如下*/CREATE PROCEDURE prplayerdataplayername char(25)ASBEGINSELECT playerdata.playername,ppg ,apg ,spg,rpg ,bpg FROM playerdata JOIN player ON playerdata .playername =player .playername J

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論