Advertisement
otkalce

Exercise10

May 30th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | Source Code | 0 0
  1. CREATE DATABASE Exercise10
  2. GO
  3.  
  4. USE Exercise10
  5. GO
  6.  
  7. CREATE TABLE Genre (
  8. [Id] [int] IDENTITY(1,1) NOT NULL,
  9. [Name] [nvarchar](256) NOT NULL,
  10. [Description] [nvarchar](max) NOT NULL,
  11. PRIMARY KEY ([Id])
  12. )
  13. GO
  14.  
  15. SET IDENTITY_INSERT Genre ON
  16. GO
  17.  
  18. INSERT INTO Genre (Id, [Name], [Description])
  19. VALUES
  20. (1, 'Rock', 'Otherwise known as ‘Rock & Roll,’ rock music has been a popular genre since the early 1950s.'),
  21. (2, 'Jazz', 'Identifiable with blues and swing notes, Jazz has origins in European and West African culture.'),
  22. (3, 'Electronic Dance Music', 'Typically referred to as EDM, this type of music is created by DJs who mix a range of beats and tones to create unique music.'),
  23. (4, 'Dubstep', 'Dubstep is an electronic dance music subgenre that originated in the late 1990s’ in South London.'),
  24. (5, 'Techno', 'Techno is yet another sub-genre of electronic dance music. This genre became popular in Germany towards the end of the 1980s and was heavily influenced by house music, funk, synthpop, and futuristic fiction.'),
  25. (6, 'Rhythm and Blues (R&B)', 'R & B is one of the world’s top music genres combining gospel, blues, and jazz influences.'),
  26. (7, 'Country', 'Country music is another one of the world’s top music genres. Originating in the 1920s, Country has its roots in western music and American folk.'),
  27. (8, 'Pop', 'The term ‘Pop’ is derived from the word ‘popular.’ Therefore, Pop music is a genre that contains music generally favored throughout society.'),
  28. (9, 'Indie Rock', 'In terms of genre, Indie Rock lies somewhere between pop music and rock and roll.'),
  29. (10, 'Electro', 'Electro blends electronic music and hip hop to create music that is similar to disco in sound.')
  30. GO
  31.  
  32. SET IDENTITY_INSERT Genre OFF
  33. GO
  34.  
  35. CREATE TABLE Artist (
  36. Id int NOT NULL IDENTITY (1, 1),
  37. [Name] nvarchar(256) NOT NULL
  38. CONSTRAINT PK_Artist
  39. PRIMARY KEY (Id)
  40. )
  41.  
  42. SET IDENTITY_INSERT Artist ON
  43. GO
  44.  
  45. INSERT INTO Artist (Id, [Name])
  46. VALUES
  47. (1, 'Tina Turner'),
  48. (2, 'Van Halen'),
  49. (3, 'DJ Snake'),
  50. (4, 'Louis Armstrong')
  51. GO
  52.  
  53. SET IDENTITY_INSERT Artist OFF
  54. GO
  55.  
  56. CREATE TABLE Song (
  57. Id int NOT NULL IDENTITY (1, 1),
  58. [Name] nvarchar(256) NOT NULL,
  59. [Year] int NULL,
  60. GenreId int NOT NULL,
  61. ArtistId int NOT NULL,
  62. DeletedAt datetime2(7) NULL,
  63. CONSTRAINT PK_Song
  64. PRIMARY KEY (Id),
  65. CONSTRAINT FK_Song_Genre
  66. FOREIGN KEY(GenreId)
  67. REFERENCES dbo.Genre (Id),
  68. CONSTRAINT FK_Song_Artist
  69. FOREIGN KEY(ArtistId)
  70. REFERENCES dbo.Artist (Id)
  71. )
  72.  
  73. SET IDENTITY_INSERT Song ON
  74. GO
  75.  
  76. INSERT INTO Song (Id, [Name], [Year], GenreId, ArtistId)
  77. VALUES
  78. (1, 'What''s Love Got to Do with It', 1984, 8, 1),
  79. (2, 'The Best', 1989, 8, 1),
  80. (3, 'Jump', 1984, 1, 2),
  81. (4, 'Lean On', 2015, 10, 3),
  82. (5, 'What a Wonderful World', 1967, 2, 4),
  83. (6, 'We Have All The Time In The World', 1969, 2, 4)
  84. GO
  85.  
  86. SET IDENTITY_INSERT Song OFF
  87. GO
Tags: Exercise10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement