CREATE TABLE [dbo].[Groups] (
[Group_Id] INT IDENTITY (1, 1) NOT NULL,
[Group_Name] NVARCHAR (50) NULL,
[Group_Desc] NVARCHAR (MAX) NULL,
CONSTRAINT [Groups.Group_Id.PrimaryKey] PRIMARY KEY CLUSTERED ([Group_Id] ASC) );
CREATE TABLE [dbo].[Group_Images] (
[ID] INT IDENTITY (1, 1) NOT NULL,
[Group_Id] INT NOT NULL, [filename] VARCHAR (250) NULL,
[imageDesc] NVARCHAR (250) NULL,
CONSTRAINT [Group_Images.ID.Primary Key] PRIMARY KEY CLUSTERED ([ID] ASC),
CONSTRAINT [Group_Images.to.Groups] FOREIGN KEY ([Group_Id]) REFERENCES [dbo].[Groups]
([Group_Id]) );
CREATE TABLE [dbo].[Photo_Collection] ( [Id] INT IDENTITY (1, 1) NOT NULL,
[Group_Id] INT NOT NULL,
[Name] NVARCHAR (250) NULL,
CONSTRAINT [Photo_Collection.Id.PrimaryKey] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [Photo_Collection.to.Groups] FOREIGN KEY ([Group_Id]) REFERENCES
[dbo].[Groups] ([Group_Id]) );
CREATE TABLE [dbo].[Photo_Collection_Images] (
[Photo_Collection_Id] INT NOT NULL,
[Group_Image_Id] INT NOT NULL,
CONSTRAINT [Photo_Collection_Images.to.Photo_Collection] FOREIGN KEY ([Photo_Collection_Id]) REFERENCES [dbo].[Photo_Collection] ([Id]), CONSTRAINT [Photo_Collection_Images.to.Group_Images] FOREIGN KEY ([Group_Image_Id]) REFERENCES [dbo].[Group_Images] ([ID]) );