以下是引用片段: if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[v_stuGrade]') and OBJECTPROPERTY(id, N'IsView') = 1) drop view [dbo].[v_stuGrade] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Admin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Admin] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AdminGroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[AdminGroup] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AdminUrl]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[AdminUrl] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[学生信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[学生信息表] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[成绩表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[成绩表] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[授课表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[授课表] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[课程表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[课程表] GO CREATE TABLE [dbo].[Admin] ( [userid] [int] IDENTITY (1, 1) NOT NULL , [username] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [password] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [group] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[AdminGroup] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [Group] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL , [Promise] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [comment] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[AdminUrl] ( [Id] [int] IDENTITY (1, 1) NOT NULL , [Url] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL , [UrlName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL , [Comment] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[学生信息表] ( [学号] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL , [姓名] [char] (10) COLLATE Chinese_PRC_CI_AS NULL , [性别] [char] (10) COLLATE Chinese_PRC_CI_AS NULL , [年龄] [tinyint] NULL , [所在院系] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [班级名] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [入学年份] [datetime] NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[成绩表] ( [学号] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL , [课程号] [char] (8) COLLATE Chinese_PRC_CI_AS NOT NULL , [成绩] [tinyint] NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[授课表] ( [教师名] [char] (10) COLLATE Chinese_PRC_CI_AS NULL , [课程号] [char] (8) COLLATE Chinese_PRC_CI_AS NOT NULL , [学时数] [tinyint] NULL , [班级名] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[课程表] ( [课程号] [char] (8) COLLATE Chinese_PRC_CI_AS NOT NULL , [课程名] [char] (20) COLLATE Chinese_PRC_CI_AS NULL , [先修课] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO CREATE VIEW dbo.v_stuGrade AS SELECT dbo.成绩表.学号, dbo.成绩表.课程号, dbo.成绩表.成绩, dbo.学生信息表.姓名, dbo.学生信息表.年龄, dbo.学生信息表.班级名, dbo.学生信息表.入学年份 FROM dbo.成绩表 INNER JOIN dbo.学生信息表 ON dbo.成绩表.学号 = dbo.学生信息表.学号 GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
|