Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.35 KB | None | 0 0
  1. use [master]
  2.  
  3. IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'BasketballStatistic')
  4.     CREATE DATABASE [BasketballStatistic]
  5. else
  6.     DROP DATABASE [BasketballStatistic]
  7.     CREATE DATABASE [BasketballStatistic]
  8. go
  9. use [BasketballStatistic]
  10.  
  11. CREATE TABLE Team
  12. (
  13. team_id INT IDENTITY(1,1) NOT NULL,
  14.  
  15. team_city VARCHAR(50) NOT NULL,
  16. team_name VARCHAR(50) NOT NULL,
  17. team_fondation_date DateTime Not null,
  18. PRIMARY KEY(team_id)
  19. );
  20.  
  21. CREATE TABLE Players
  22. (
  23. player_id INT IDENTITY(1,1) NOT NULL,
  24. current_team_id int not Null,
  25. player_name VARCHAR(50) NOT NULL,
  26. player_surname VARCHAR(50) NOT NULL,
  27. player_country  VARCHAR(50) NOT NULL,
  28. player_born_date DateTime Not null,
  29. PRIMARY KEY(player_id)
  30. );
  31.  
  32. CREATE TABLE Contracts
  33. (
  34. Contract_id INT IDENTITY(1,1) NOT NULL,
  35. team_id int not Null,
  36. player_id int not Null,
  37. player_number int not Null,
  38. contract_start_time DateTime not null,
  39. contract_end_time DateTime not null,
  40. PRIMARY KEY(Contract_id)
  41. );
  42. /**/
  43. CREATE TABLE Player_statistic
  44. (
  45. statistic_id INT IDENTITY(1,1) NOT NULL,
  46. Contract_id int not Null,
  47. one_point int not Null,
  48. two_point int not Null,
  49. three_point int not Null,
  50. fols_commited int not null,
  51. block_shots int not null,
  52. wins int not null,
  53. loses int not null,
  54. draws int not null,
  55. loses_on_draw int not null,
  56. wins_on_draw int not null,
  57.  
  58. PRIMARY KEY(statistic_id)
  59. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement