USE [MySchool]
GO
/****** Object: Table [dbo].[Grade] Script Date: 08/06/2014 15:03:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Grade](
[GradeId] [int] IDENTITY(1,1) NOT NULL,
[GradeName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_Grade_1] PRIMARY KEY CLUSTERED
(
[GradeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [IX_Grade_GradeName] UNIQUE NONCLUSTERED
(
[GradeId] 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
SET IDENTITY_INSERT [dbo].[Grade] ON
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (1, N'S1')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (2, N'S2')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (3, N'Y2')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (4, N'精英班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (11, N'zhanan')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (12, N'S1288无敌班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (13, N'高一二班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (14, N'高一三班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (15, N'高一一班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (16, N'高一1班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (17, N'高一2班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (18, N'高一3班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (19, N'aa')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (20, N'mine')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (21, N'mine')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (22, N'mine')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (23, N'mine')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (26, N'无敌S2214')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (27, N'无敌S2214')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (28, N'好人2214')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (30, N'aa')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (31, N'bb')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (32, N'cc')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (33, N'dd')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (34, N'S2216')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (48, N'S2216第二个班')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (49, N'S2216终结版')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (51, N'JDBC测试啊啊啊啊')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (52, N'JDBC测试啊啊啊啊2')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (53, N'JDBC测试啊啊啊啊2')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (54, N'DBC啊速度速度')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (55, N'DBC阿萨德完全')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (56, N'DBC阿萨德完全')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (57, N'DBC阿萨德完全')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (58, N'aa')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (59, N'bb')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (60, N'aaa''')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (61, N'ccc')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (62, N'')
INSERT [dbo].[Grade] ([GradeId], [GradeName]) VALUES (63, N's1')
SET IDENTITY_INSERT [dbo].[Grade] OFF
/****** Object: Table [dbo].[Subject] Script Date: 08/06/2014 15:03:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Subject](
[SubjectId] [int] IDENTITY(1,1) NOT NULL,
[SubjectName] [nchar](10) NOT NULL,
[ClassHour] [int] NULL,
[GradeId] [int] NOT NULL,
CONSTRAINT [PK_Subject] PRIMARY KEY CLUSTERED
(
[SubjectId] 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
SET IDENTITY_INSERT [dbo].[Subject] ON
INSERT [dbo].[Subject] ([SubjectId], [SubjectName], [ClassHour], [GradeId]) VALUES (1, N'oop ', 78, 1)
INSERT [dbo].[Subject] ([SubjectId], [SubjectName], [ClassHour], [GradeId]) VALUES (2, N'java ', 67, 2)
INSERT [dbo].[Subject] ([SubjectId], [SubjectName], [ClassHour], [GradeId]) VALUES (3, N'C# ', 78, 3)
INSERT [dbo].[Subject] ([SubjectId], [SubjectName], [ClassHour], [GradeId]) VALUES (4, N'分层开发 ', 24, 2)
SET IDENTITY_INSERT [dbo].[Subject] OFF
/****** Object: Table [dbo].[Student] Script Date: 08/06/2014 15:03:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Student](
[StudentNo] [int] IDENTITY(1000,1) NOT NULL,
[LoginPwd] [nvarchar](50) NOT NULL,
[StudentName] [nvarchar](50) NOT NULL,
[Gender] [char](1) NULL,
[GradeId] [int] NOT NULL,
[Phone] [nvarchar](255) NULL,
[Address] [nvarchar](255) NULL,
[Birthday] [datetime] NULL,
[Email] [nvarchar](50) NULL,
[MyTT] [int] NULL,
CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED
(
[StudentNo] 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
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Student] ON
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23, N'', N'灰太狼2222', N'', 2, N'', N'中国平安啊啊', CAST(0x0000759800000000 AS DateTime), N'好@3', 1)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23213, N'', N'李金香好人', N'', 3, N'13835231533/13503542995', N'北京海淀区北宫门', CAST(0x0000759800000000 AS DateTime), N'1@3', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23219, N'', N'美洋洋222', N'', 2, N'', N'北京市海淀区', CAST(0x000081D500000000 AS DateTime), N'1@3', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23225, N'', N'张靓颖', N'', 2, N'', N'北京市海淀区', CAST(0x0000A1E5009B6025 AS DateTime), N'1@3', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23268, N'', N'张玲', N'', 2, N'', N'北京', CAST(0x0000A0BA011CBBCC AS DateTime), N'1@3', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23270, N'', N'李小龙', N'', 2, NULL, N'武汉', CAST(0x0000A227011C8BC0 AS DateTime), N'1@3', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23311, N'', N'微冷的雨', N'', 1, N'', N'', CAST(0x0000A2D000C38D54 AS DateTime), N'[email protected]', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23316, N'', N'习小平', N'', 4, N'010-1234567', N'北京人民大会堂', CAST(0x00008D8900FBB008 AS DateTime), N'[email protected]', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23317, N'', N'', N'', 1, N'', N'', CAST(0x0000A2F000FCE310 AS DateTime), N'@', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23318, N'', N'习小平222', N'', 4, N'', N'北京任命', CAST(0x0000A2F000FD4DB4 AS DateTime), N'[email protected]', NULL)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23322, N'', N'张靓颖', N'', 1, N'010-123', N'中国', CAST(0x0000A2FE00A0C0BC AS DateTime), N'zly@', 11)
INSERT [dbo].[Student] ([StudentNo], [LoginPwd], [StudentName], [Gender], [GradeId], [Phone], [Address], [Birthday], [Email], [MyTT]) VALUES (23323, N'', N'张靓颖', N'', 1, N'010-123', N'中国', CAST(0x0000A2FE00A0C0BC AS DateTime), N'zly@', 11)
SET IDENTITY_INSERT [dbo].[Student] OFF
/****** Object: Table [dbo].[Result] Script Date: 08/06/2014 15:03:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Result](
[StudentNo] [int] NOT NULL,
[SubjectId] [int] NOT NULL,
[StudentResult] [int] NOT NULL,
[ExamDate] [datetime] NOT NULL,
[Id] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_Result] PRIMARY KEY CLUSTERED
(
[Id] 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
SET IDENTITY_INSERT [dbo].[Result] ON
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23219, 2, 92, CAST(0x0000A215010D13FC AS DateTime), 1)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23213, 1, 58, CAST(0x00009C8200000000 AS DateTime), 2)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23213, 1, 92, CAST(0x0000A215010D13FC AS DateTime), 3)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23219, 2, 82, CAST(0x00009C9D00000000 AS DateTime), 4)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23231, 1, 93, CAST(0x0000A1ED009052E0 AS DateTime), 5)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23231, 2, 97, CAST(0x0000A1ED00905C40 AS DateTime), 6)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23213, 1, 96, CAST(0x00009C7F00000000 AS DateTime), 9)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23213, 2, 93, CAST(0x00009C7F00000000 AS DateTime), 10)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23225, 1, 62, CAST(0x0000A215010D13FC AS DateTime), 11)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23225, 2, 48, CAST(0x0000A215010D27E8 AS DateTime), 12)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23225, 3, 98, CAST(0x0000A2DA00C441CC AS DateTime), 16)
INSERT [dbo].[Result] ([StudentNo], [SubjectId], [StudentResult], [ExamDate], [Id]) VALUES (23213, 3, 98, CAST(0x0000A2DB00CAB4F8 AS DateTime), 17)
SET IDENTITY_INSERT [dbo].[Result] OFF
/****** Object: Default [DF_Student_GradeId] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] ADD CONSTRAINT [DF_Student_GradeId] DEFAULT ((1)) FOR [GradeId]
GO
/****** Object: Check [CK_Student_Birthday] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [CK_Student_Birthday] CHECK (([BirthDay]>'1970-01-01'))
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [CK_Student_Birthday]
GO
/****** Object: Check [CK_Student_Email] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [CK_Student_Email] CHECK (([Email] like '%@%'))
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [CK_Student_Email]
GO
/****** Object: Check [CK_Student_Gender] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [CK_Student_Gender] CHECK (([Gender]=(0) OR [Gender]=''))
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [CK_Student_Gender]
GO
/****** Object: Check [CK_Student_LoginPwd] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [CK_Student_LoginPwd] CHECK ((len([LoginPwd])>=(6)))
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [CK_Student_LoginPwd]
GO
/****** Object: Check [CK_studentname] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [CK_studentname] CHECK (([studentname] IS NOT NULL))
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [CK_studentname]
GO
/****** Object: Check [CK_Result_StudentResult] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Result] WITH CHECK ADD CONSTRAINT [CK_Result_StudentResult] CHECK (([StudentResult]>=(0) AND [Studentresult]<=(100)))
GO
ALTER TABLE [dbo].[Result] CHECK CONSTRAINT [CK_Result_StudentResult]
GO
/****** Object: ForeignKey [FK_Student_GradeId] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Student] WITH CHECK ADD CONSTRAINT [FK_Student_GradeId] FOREIGN KEY([GradeId])
REFERENCES [dbo].[Grade] ([GradeId])
GO
ALTER TABLE [dbo].[Student] CHECK CONSTRAINT [FK_Student_GradeId]
GO
/****** Object: ForeignKey [FK_Subject_Grade] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Subject] WITH CHECK ADD CONSTRAINT [FK_Subject_Grade] FOREIGN KEY([GradeId])
REFERENCES [dbo].[Grade] ([GradeId])
GO
ALTER TABLE [dbo].[Subject] CHECK CONSTRAINT [FK_Subject_Grade]
GO
/****** Object: ForeignKey [FK_Result_Subject] Script Date: 08/06/2014 15:03:17 ******/
ALTER TABLE [dbo].[Result] WITH CHECK ADD CONSTRAINT [FK_Result_Subject] FOREIGN KEY([SubjectId])
REFERENCES [dbo].[Subject] ([SubjectId])
GO
ALTER TABLE [dbo].[Result] CHECK CONSTRAINT [FK_Result_Subject]
GO