⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 szxy5.0.sql

📁 实习的时候做的数字校园系统
💻 SQL
📖 第 1 页 / 共 2 页
字号:
create table exam (
   ex_id                varchar(20)          not null,
   e_km                 varchar(20)          null,
   bj                   varchar(20)          null,
   rs                   int                  null,
   e_data               datetime             null,
   e_type               varchar(20)          null,
   xq                   varchar(20)          null,
   constraint PK_EXAM primary key  (ex_id)
)
go


/*==============================================================*/
/* Table: kaocang                                               */
/*==============================================================*/
create table kaocang (
   "cr_NO."             varchar(5)           null,
   ex_id                varchar(20)          null,
   jk_teacher           varchar(20)          null,
   test_time            datetime             null,
   memory               text                 null
)
go


/*==============================================================*/
/* Index: Relationship_15_FK                                    */
/*==============================================================*/
create   index Relationship_15_FK on kaocang (
ex_id
)
go


/*==============================================================*/
/* Index: Relationship_16_FK                                    */
/*==============================================================*/
create   index Relationship_16_FK on kaocang (
"cr_NO."
)
go


/*==============================================================*/
/* Table: kc                                                    */
/*==============================================================*/
create table kc (
   kch                  varchar(20)          not null,
   kcm                  varchar(20)          null,
   constraint PK_KC primary key  (kch)
)
go


/*==============================================================*/
/* Table: newstudent                                            */
/*==============================================================*/
create table newstudent (
   "testNo."            numeric              identity,
   s_name               char(20)             null,
   sex                  bit                  null,
   age                  int                  null,
   photo                image                null,
   jg                   varchar(50)          null,
   zzmm                 varchar(10)          null,
   adress               varchar(100)         null,
   phone                bigint               null,
   yesorno              bit                  null,
   memory               text                 null,
   constraint PK_NEWSTUDENT primary key  ("testNo.")
)
go


/*==============================================================*/
/* Table: "plan"                                                */
/*==============================================================*/
create table "plan" (
   p_id                 int                  not null,
   t_id                 numeric              not null,
   p_type               varchar(20)          null,
   p_data               datetime             null,
   p_ms                 text                 null,
   constraint PK_PLAN primary key  (p_id)
)
go


/*==============================================================*/
/* Index: Relationship_19_FK                                    */
/*==============================================================*/
create   index Relationship_19_FK on "plan" (
t_id
)
go


/*==============================================================*/
/* Table: schoolinfo                                            */
/*==============================================================*/
create table schoolinfo (
   sch_id               varchar(30)          not null,
   sch_jbxx             text                 null,
   sch_adress           varchar(30)          null,
   bmxx                 text                 null,
   bgsdh                varchar(20)          null,
   constraint PK_SCHOOLINFO primary key  (sch_id)
)
go


/*==============================================================*/
/* Table: score                                                 */
/*==============================================================*/
create table score (
   kch                  varchar(20)          not null,
   s_id                 int                  not null,
   score                float(6)             null,
   constraint PK_SCORE primary key  (kch, s_id)
)
go


/*==============================================================*/
/* Index: Relationship_1_FK                                     */
/*==============================================================*/
create   index Relationship_1_FK on score (
kch
)
go


/*==============================================================*/
/* Index: Relationship_2_FK                                     */
/*==============================================================*/
create   index Relationship_2_FK on score (
s_id
)
go


/*==============================================================*/
/* Table: student                                               */
/*==============================================================*/
create table student (
   s_id                 int                  not null,
   "testNo."            numeric              null,
   s_name               char(20)             null,
   sex                  bit                  null,
   age                  int                  null,
   photo                image                null,
   jg                   varchar(50)          null,
   grade                varchar(10)          null,
   class                varchar(10)          null,
   job                  varchar(20)          null,
   zzmm                 varchar(10)          null,
   adress               varchar(100)         null,
   phone                bigint               null,
   memory               text                 null,
   yesorno              bit                  null,
   constraint PK_STUDENT primary key  (s_id)
)
go


/*==============================================================*/
/* Index: Relationship_13_FK                                    */
/*==============================================================*/
create   index Relationship_13_FK on student (
"testNo."
)
go


/*==============================================================*/
/* Table: teacher                                               */
/*==============================================================*/
create table teacher (
   t_id                 numeric              identity,
   t_name               char(20)             null,
   sex                  bit                  null,
   age                  int                  null,
   photo                image                null,
   zzmm                 varchar(10)          null,
   phone                bigint               null,
   prtime               datetime             null,
   firetime             datetime             null,
   jobtest              text                 null,
   jcqk                 text                 null,
   kwcg                 text                 null,
   memory               text                 null,
   constraint PK_TEACHER primary key  (t_id)
)
go


/*==============================================================*/
/* Table: teacherbz                                             */
/*==============================================================*/
create table teacherbz (
   t_id                 numeric              not null,
   bmh                  varchar(20)          not null,
   zw                   varchar(20)          null,
   constraint PK_TEACHERBZ primary key  (t_id, bmh)
)
go


/*==============================================================*/
/* Index: Relationship_17_FK                                    */
/*==============================================================*/
create   index Relationship_17_FK on teacherbz (
t_id
)
go


/*==============================================================*/
/* Index: Relationship_18_FK                                    */
/*==============================================================*/
create   index Relationship_18_FK on teacherbz (
bmh
)
go


/*==============================================================*/
/* Table: teachertest                                           */
/*==============================================================*/
create table teachertest (
   t_id                 numeric              not null,
   gzkpf                float(6)             null,
   jcqkf                float(6)             null,
   kwcgf                float(6)             null,
   total                float(6)             null,
   zhpj                 text                 null
)
go


/*==============================================================*/
/* Index: Relationship_8_FK                                     */
/*==============================================================*/
create   index Relationship_8_FK on teachertest (
t_id
)
go


/*==============================================================*/
/* Table: userpassword                                          */
/*==============================================================*/
create table userpassword (
   "user"               varchar(15)          not null,
   password             varchar(20)          null,
   constraint PK_USERPASSWORD primary key  ("user")
)
go


/*==============================================================*/
/* Table: xjbdqk                                                */
/*==============================================================*/
create table xjbdqk (
   s_id                 int                  not null,
   m_time               datetime             null,
   m_type               varchar(30)          null,
   m_reson              varchar(30)          null,
   m_jg                 text                 null
)
go


/*==============================================================*/
/* Index: Relationship_21_FK                                    */
/*==============================================================*/
create   index Relationship_21_FK on xjbdqk (
s_id
)
go


alter table StudentInformation
   add constraint FK_STUDENTI_RELATIONS_STUDENT foreign key (s_id)
      references student (s_id)
go


alter table kaocang
   add constraint FK_KAOCANG_RELATIONS_EXAM foreign key (ex_id)
      references exam (ex_id)
go


alter table kaocang
   add constraint FK_KAOCANG_RELATIONS_CLASSROO foreign key ("cr_NO.")
      references Classroom ("cr_NO.")
go


alter table "plan"
   add constraint FK_PLAN_RELATIONS_TEACHER foreign key (t_id)
      references teacher (t_id)
go


alter table score
   add constraint FK_SCORE_RELATIONS_KC foreign key (kch)
      references kc (kch)
go


alter table score
   add constraint FK_SCORE_RELATIONS_STUDENT foreign key (s_id)
      references student (s_id)
go


alter table student
   add constraint FK_STUDENT_RELATIONS_NEWSTUDE foreign key ("testNo.")
      references newstudent ("testNo.")
go


alter table teacherbz
   add constraint FK_TEACHERB_RELATIONS_TEACHER foreign key (t_id)
      references teacher (t_id)
go


alter table teacherbz
   add constraint FK_TEACHERB_RELATIONS_BM foreign key (bmh)
      references bm (bmh)
go


alter table teachertest
   add constraint FK_TEACHERT_RELATIONS_TEACHER foreign key (t_id)
      references teacher (t_id)
go


alter table xjbdqk
   add constraint FK_XJBDQK_RELATIONS_STUDENT foreign key (s_id)
      references student (s_id)
go


⌨️ 快捷键说明

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