Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE [Tag] (
- [Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
- [Name] [nvarchar](10) NOT NULL)
- GO
- CREATE TABLE [dbo].[Genre](
- [Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
- [Name] [nvarchar](256) NOT NULL)
- GO
- CREATE TABLE [dbo].[Audio](
- [Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
- [CreatedAt] [datetime2](7) NOT NULL,
- [Title] [nvarchar](256) NOT NULL,
- [GenreId] [int] NOT NULL,
- [Duration] [int] NOT NULL,
- [Url] [nvarchar](256) NULL)
- GO
- CREATE TABLE [dbo].[AudioTag](
- [Id] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
- [AudioId] [int] NOT NULL,
- [TagId] [int] NOT NULL)
- GO
- ALTER TABLE [dbo].[Audio]
- ADD CONSTRAINT [FK_Audio_Genre]
- FOREIGN KEY([GenreId])
- REFERENCES [dbo].[Genre] ([Id])
- GO
- ALTER TABLE [dbo].[AudioTag]
- ADD CONSTRAINT [FK_AudioTag_Audio]
- FOREIGN KEY([AudioId])
- REFERENCES [dbo].[Audio] ([Id])
- GO
- ALTER TABLE [dbo].[AudioTag]
- ADD CONSTRAINT [FK_AudioTag_Tag]
- FOREIGN KEY([TagId])
- REFERENCES [dbo].[Tag] ([Id])
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement