Advertisement
dimitrova_elka

Untitled

Sep 10th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 2.17 KB | None | 0 0
  1. USE master
  2.  
  3. CREATE DATABASE Movies
  4.  
  5. CREATE TABLE Directors
  6. (Id int NOT NULL PRIMARY KEY IDENTITY,
  7. DirectorName nvarchar(50) NOT NULL,
  8. Notes nvarchar(255))
  9.  
  10. INSERT INTO Directors (DirectorName)
  11. VALUES ('Stiven Spilberg')
  12.  
  13. INSERT INTO Directors (DirectorName)
  14. VALUES ('Хачо Бояджиев')
  15.  
  16. INSERT INTO Directors (DirectorName)
  17. VALUES ('James Cameron')
  18.  
  19. INSERT INTO Directors (DirectorName)
  20. VALUES ('Robert Zemeckis')
  21.  
  22. INSERT INTO Directors (DirectorName)
  23. VALUES ('Peter Jackson')
  24.  
  25. CREATE TABLE Genres
  26. (Id int NOT NULL PRIMARY KEY IDENTITY,
  27. GenreName nvarchar(50) NOT NULL,
  28. Notes nvarchar(255))
  29.  
  30. INSERT INTO Genres(GenreName)
  31. VALUES ('Comedy')
  32.  
  33. INSERT INTO Genres(GenreName)
  34. VALUES ('Horror')
  35.  
  36. INSERT INTO Genres(GenreName)
  37. VALUES ('Action')
  38.  
  39. INSERT INTO Genres(GenreName)
  40. VALUES ('Crime')
  41.  
  42. INSERT INTO Genres(GenreName)
  43. VALUES ('Adventure')
  44.  
  45. CREATE TABLE Categories
  46. (Id int NOT NULL PRIMARY KEY IDENTITY,
  47. CategoryName nvarchar(50) NOT NULL,
  48. Notes nvarchar(255))
  49.  
  50. INSERT INTO Categories(CategoryName)
  51. VALUES ('Popular')
  52.  
  53. INSERT INTO Categories(CategoryName)
  54. VALUES ('Bollywood')
  55.  
  56. INSERT INTO Categories(CategoryName)
  57. VALUES ('Cartoon')
  58.  
  59. INSERT INTO Categories(CategoryName)
  60. VALUES ('Hollywood')
  61.  
  62. INSERT INTO Categories(CategoryName)
  63. VALUES ('another')
  64.  
  65. -- Movies (Id, Title, DirectorId, CopyrightYear, Length, GenreId, CategoryId, Rating, Notes)
  66.  
  67. CREATE TABLE Movies
  68. (Id int NOT NULL PRIMARY KEY IDENTITY,
  69. Title nvarchar(50) NOT NULL,
  70. DirectorId int NOT NULL,
  71. CopyrightYear int,
  72. Length int,
  73. GenreId int NOT NULL,
  74. CategoryId int NOT NULL,
  75. Rating int,
  76. Notes nvarchar(255))
  77.  
  78. INSERT INTO Movies (Title, DirectorId, GenreId, CategoryId)
  79. VALUES ('Terminator', 3, 3, 4)
  80.  
  81. INSERT INTO Movies (Title, DirectorId, GenreId, CategoryId)
  82. VALUES ('Indiana Jones and the Last Crusade', 1, 3, 4)
  83.  
  84. INSERT INTO Movies (Title, DirectorId, GenreId, CategoryId)
  85. VALUES ('Some film', 5, 5, 5)
  86.  
  87. INSERT INTO Movies (Title, DirectorId, GenreId, CategoryId)
  88. VALUES ('Криворазбраната цивилизация', 2, 1, 5)
  89.  
  90. INSERT INTO Movies (Title, DirectorId, GenreId, CategoryId)
  91. VALUES ('Another film', 1, 1, 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement