crebas.dat

来自「(1)全校选修计划课程管理; (2)全校选修开课课程管理; (3)全校学生选」· DAT 代码 · 共 99 行

DAT
99
字号
/*==============================================================*/
/* DBMS name:      Microsoft SQL Server 2000                    */
/* Created on:     2008-12-9 22:31:48                           */
/*==============================================================*/


alter table COURSE
   drop constraint FK_COURSE_REFERENCE_SC
go

alter table Students
   drop constraint FK_STUDENTS_REFERENCE_SC
go

if exists (select 1
            from  sysobjects
           where  id = object_id('COURSE')
            and   type = 'U')
   drop table COURSE
go

if exists (select 1
            from  sysobjects
           where  id = object_id('SC')
            and   type = 'U')
   drop table SC
go

if exists (select 1
            from  sysobjects
           where  id = object_id('Students')
            and   type = 'U')
   drop table Students
go

/*==============================================================*/
/* Table: COURSE                                                */
/*==============================================================*/
create table COURSE (
   Cno                  integer              not null,
   Tno                  integer              null,
   Cname                varchar(10)          not null,
   Sno                  integer              null,
   Credit               float                null,
   Ctime                datetime             null,
   Cmark                float                null,
   Caddr                varchar(10)          null,
   Cexamt               varchar(10)          null,
   Cterm                varchar(10)          null,
   constraint PK_COURSE primary key (Cno, Cname)
)
go

/*==============================================================*/
/* Table: SC                                                    */
/*==============================================================*/
create table SC (
   Sno                  integer              not null,
   Cno                  integer              not null,
   Tno                  integer              not null,
   Cterm                varchar(10)          null,
   Cmark                float                null,
   Column_6             char(10)             null,
   constraint PK_SC primary key (Sno, Cno, Tno)
)
go

/*==============================================================*/
/* Table: Students                                              */
/*==============================================================*/
create table Students (
   Sno                  integer              not null,
   Cno                  integer              null,
   Tno                  integer              null,
   Sname                varchar(10)          not null,
   Ssex                 varchar(2)           null,
   Sbir                 datetime             null,
   Stime                datetime             null,
   Stel                 integer              null,
   Semail               varchar(20)          null,
   Scollege             varchar(10)          null,
   Smajor               varchar(10)          null,
   Saddr                varchar(10)          null,
   Sbei                 varchar(255)         null,
   constraint PK_STUDENTS primary key (Sno, Sname)
)
go

alter table COURSE
   add constraint FK_COURSE_REFERENCE_SC foreign key (Sno, Cno, Tno)
      references SC (Sno, Cno, Tno)
go

alter table Students
   add constraint FK_STUDENTS_REFERENCE_SC foreign key (Sno, Cno, Tno)
      references SC (Sno, Cno, Tno)
go

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?