

/****** Object:  Table [dbo].[UserTable]    Script Date: 10/06/2009 09:56:24 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[UserTable](
	[UserID] [int] NOT NULL,
	[Email] [nvarchar](255) NULL,
	[Name] [nvarchar](100) NULL,
 CONSTRAINT [PK_UserTable] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


/****** Object:  Table [dbo].[GameTable]    Script Date: 10/06/2009 09:56:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[GameTable](
	[GameID] [int] NOT NULL,
	[GameStatus] [nvarchar](15) NOT NULL,
	[PlayerScore] [int] NOT NULL,
	[DealerScore] [int] NOT NULL,
 CONSTRAINT [PK_GameTable] PRIMARY KEY CLUSTERED 
(
	[GameID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


/****** Object:  Table [dbo].[UserGame]    Script Date: 10/06/2009 09:57:03 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[UserGame](
	[UserID] [int] NOT NULL,
	[GameID] [int] NOT NULL,
 CONSTRAINT [PK_UserGame] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC,
	[GameID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[UserGame]  WITH CHECK ADD  CONSTRAINT [FK_UserGame_GameTable] FOREIGN KEY([GameID])
REFERENCES [dbo].[GameTable] ([GameID])
GO

ALTER TABLE [dbo].[UserGame] CHECK CONSTRAINT [FK_UserGame_GameTable]
GO

ALTER TABLE [dbo].[UserGame]  WITH CHECK ADD  CONSTRAINT [FK_UserGame_UserTable] FOREIGN KEY([UserID])
REFERENCES [dbo].[UserTable] ([UserID])
GO

ALTER TABLE [dbo].[UserGame] CHECK CONSTRAINT [FK_UserGame_UserTable]
GO


