/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2016/8/29 14:36:01 */
/*==============================================================*/
drop table if exists CHATINFO;
drop table if exists FRIENDS;
drop table if exists GETPWD;
drop table if exists GETPWDINFO;
drop table if exists GROUPTABLE;
drop table if exists LOGIN;
drop table if exists SUBGROUP;
drop table if exists TEXT;
drop table if exists USERINFO;
drop table if exists USER_GROUP;
/*==============================================================*/
/* Table: CHATINFO */
/*==============================================================*/
create table CHATINFO
(
CNO int not null AUTO_INCREMENT,
CSENDQQ int,
CRECEIVEQQ int,
CDATE timestamp,
TNO int,
primary key (CNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: FRIENDS */
/*==============================================================*/
create table FRIENDS
(
FNO int not null AUTO_INCREMENT,
FQQ int,
FSNO int,
FDATE datetime,
FSTATUS int,
QQ int,
primary key (FNO),
check (fstatus in (1,0))
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: GETPWD */
/*==============================================================*/
create table GETPWD
(
GNO int not null AUTO_INCREMENT,
QUESTION1 varchar(50),
ANSWER1 varchar(20),
QUESTION2 varchar(50),
ANSWER2 varchar(20),
QUESTION3 varchar(50),
ANSWER3 varchar(20),
GQQ int,
primary key (GNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: GETPWDINFO */
/*==============================================================*/
create table GETPWDINFO
(
GPNO int not null AUTO_INCREMENT,
QUESTION int,
ANSWER varchar(50),
GQQ int,
primary key (GPNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: GROUPTABLE */
/*==============================================================*/
create table GROUPTABLE
(
GNO int not null AUTO_INCREMENT,
GNAME varchar(20),
GDATE datetime,
primary key (GNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: LOGIN */
/*==============================================================*/
create table LOGIN
(
LNO int not null AUTO_INCREMENT,
LIP varchar(20),
LPORT int,
LDATE timestamp,
LSTATUS int,
LQQ int,
primary key (LNO),
check (lstatus in (1,0))
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: SUBGROUP */
/*==============================================================*/
create table SUBGROUP
(
SNO int not null AUTO_INCREMENT,
SNAME varchar(20),
SDATE datetime,
QQ int,
primary key (SNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: TEXT */
/*==============================================================*/
create table TEXT
(
TNO int not null AUTO_INCREMENT,
TCONTEXT varchar(200),
TFONTTYPE varchar(10),
TFONTSIZE varchar(5),
TFONTCOLOR varchar(50),
TFONTBOLD int,
TFONTITATIC int,
TFONTUNDERLINE int,
primary key (TNO)
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: USERINFO */
/*==============================================================*/
create table USERINFO
(
QQ int not null AUTO_INCREMENT,
PWD varchar(10),
SIGN varchar(30),
PHOTOID int,
NICKNAME varchar(10),
SEX char(2),
BIRTHDAY datetime,
CONSTELLATION varchar(50),
BLOODTYPE char(10),
DIPLOMA varchar(10),
TELEPHONE varchar(15),
EMAIL varchar(20),
ADDRESS varchar(20),
primary key (QQ),
check (sex IN ('','Ů'))
)engine=innodb AUTO_INCREMENT=0;
/*==============================================================*/
/* Table: USER_GROUP */
/*==============================================================*/
create table USER_GROUP
(
UGNO int not null AUTO_INCREMENT,
QQ int,
GNO int,
primary key (UGNO)
)engine=innodb AUTO_INCREMENT=0;
alter table CHATINFO add constraint FK_CRECEIVEQQ foreign key (CRECEIVEQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table CHATINFO add constraint FK_CSENDQQ foreign key (CSENDQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table CHATINFO add constraint FK_TNO foreign key (TNO)
references TEXT (TNO) on delete restrict on update restrict;
alter table FRIENDS add constraint FK_FQQ foreign key (FQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table FRIENDS add constraint FK_QQ foreign key (QQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table FRIENDS add constraint FK_SNO foreign key (FSNO)
references SUBGROUP (SNO) on delete restrict on update restrict;
alter table GETPWD add constraint FK_GQQ foreign key (GQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table GETPWDINFO add constraint FK_GETQQ foreign key (GQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table LOGIN add constraint FK_LQQ foreign key (LQQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table SUBGROUP add constraint FK_SUBQQ foreign key (QQ)
references USERINFO (QQ) on delete restrict on update restrict;
alter table USER_GROUP add constraint FK_GNO foreign key (GNO)
references GROUPTABLE (GNO) on delete restrict on update restrict;
alter table USER_GROUP add constraint FK_UGQQ foreign key (QQ)
references USERINFO (QQ) on delete restrict on update restrict;
一键复制
编辑
Web IDE
原始数据
按行查看
历史