Advertisement
otkalce

Exercise9

May 30th, 2024
1,012
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 2.56 KB | Source Code | 0 0
  1. CREATE DATABASE Exercise9
  2. GO
  3.  
  4. USE Exercise9
  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 Song (
  36.   Id int NOT NULL IDENTITY (1, 1),
  37.   [Name] nvarchar(256) NOT NULL,
  38.   [Year] int NULL,
  39.   GenreId int NOT NULL,
  40.   DeletedAt datetime2(7) NULL,
  41.   CONSTRAINT PK_Song
  42.     PRIMARY KEY (Id),
  43.   CONSTRAINT FK_Song_Genre
  44.     FOREIGN KEY(GenreId)
  45.     REFERENCES dbo.Genre (Id)
  46. )
  47.  
  48. SET IDENTITY_INSERT Song ON
  49. GO
  50.  
  51. INSERT INTO Song (Id, [Name], [Year], GenreId, DeletedAt)
  52. VALUES
  53.   (1, 'A-ha - Take On Me', 1985, 8, NULL),
  54.   (2, 'Tina Turner - What''s Love Got to Do with It', 1984, 8, NULL),
  55.   (3, 'Van Halen - Jump', 1984, 1, NULL),
  56.   (4, 'Franz Ferdinand - Take Me Out', 2004, 9, NULL),
  57.   (5, 'DJ Snake - Lean On', 2015, 10, NULL),
  58.   (6, 'Louis Armstrong - What a Wonderful World', 1967, 2, NULL),
  59.   (7, 'Deleted Song', 1967, 2, '2024-04-27 11:41:00')
  60. GO
  61.  
  62. SET IDENTITY_INSERT Song OFF
  63. GO
Tags: Exercise9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement