SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Users]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Users](
[UserID] [varchar](20) NOT NULL,
[UserName] [varchar](20) NOT NULL,
[UserPwd] [varchar](20) NOT NULL,
[UserPower] [int] NOT NULL,
CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Score]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Score](
[ID] [int] IDENTITY(1,1) NOT NULL,
[UserID] [varchar](20) NOT NULL,
[PaperID] [int] NOT NULL,
[Score] [int] NOT NULL,
[ExamTime] [datetime] NOT NULL CONSTRAINT [DF_Score_ExamTime] DEFAULT (getdate()),
CONSTRAINT [PK_Score] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SingleProblem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[SingleProblem](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[Title] [varchar](1000) NOT NULL,
[AnswerA] [varchar](500) NOT NULL,
[AnswerB] [varchar](500) NOT NULL,
[AnswerC] [varchar](500) NOT NULL,
[AnswerD] [varchar](500) NOT NULL,
[Answer] [varchar](2) NOT NULL,
CONSTRAINT [PK_SingleProblem] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Course]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Course](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](200) NOT NULL,
CONSTRAINT [PK_Course] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JudgeProblem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[JudgeProblem](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[Title] [varchar](1000) NOT NULL,
[Answer] [bit] NOT NULL,
CONSTRAINT [PK_JudgeProblem] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MultiProblem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[MultiProblem](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[Title] [varchar](1000) NOT NULL,
[AnswerA] [varchar](500) NOT NULL,
[AnswerB] [varchar](500) NOT NULL,
[AnswerC] [varchar](500) NOT NULL,
[AnswerD] [varchar](500) NOT NULL,
[Answer] [varchar](50) NOT NULL,
CONSTRAINT [PK_MultiProblem] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FillBlankProblem]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[FillBlankProblem](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[FrontTitle] [varchar](500) NULL,
[BackTitle] [varchar](500) NULL,
[Answer] [varchar](200) NOT NULL,
CONSTRAINT [PK_FillBlankProblem] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Paper]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Paper](
[PaperID] [int] IDENTITY(1,1) NOT NULL,
[CourseID] [int] NOT NULL,
[PaperName] [varchar](200) NOT NULL,
[PaperState�