/*==============================================================*/
/* DBMS name: MySQL 4.0 */
/* Created on: 2006-9-29 22:23:48 */
/*==============================================================*/
drop table if exists DIC_NEWS_CLASS;drop table if exists DIC_NEWS_TYPE;drop table if exists DIC_SEX;drop table if exists NEWS;drop table if exists TEMPLATE;drop table if exists USER;/*==============================================================*/
/* Table: DIC_NEWS_CLASS */
/*==============================================================*/
create table DIC_NEWS_CLASS
(
NEWS_CLASS_ID integer not null AUTO_INCREMENT,
NAME varchar(20),
ENG_NAME varchar(20),
primary key (NEWS_CLASS_ID)
)
comment = "新闻栏目"
type = InnoDB;/*==============================================================*/
/* Index: INDEX_NEWS_CLASS_ID */
/*==============================================================*/
create unique index INDEX_NEWS_CLASS_ID on DIC_NEWS_CLASS
(
NEWS_CLASS_ID
);/*==============================================================*/
/* Table: DIC_NEWS_TYPE */
/*==============================================================*/
create table DIC_NEWS_TYPE
(
NEWS_TYPE_ID integer not null AUTO_INCREMENT,
NAME varchar(20),
primary key (NEWS_TYPE_ID)
)
comment = "新闻类型"
type = InnoDB;/*==============================================================*/
/* Table: DIC_SEX */
/*==============================================================*/
create table DIC_SEX
(
SEX_ID tinyint not null,
NAME varchar(2),
primary key (SEX_ID)
)
type = InnoDB;/*==============================================================*/
/* Table: NEWS */
/*==============================================================*/
create table NEWS
(
NEWS_ID int not null AUTO_INCREMENT,
TITLE varchar(20),
URL varchar(50),
FILE_NAME varchar(20),
CONTENT text,
KEYWORD varchar(20),
author varchar(20),
FROM_WHERE varchar(20),
DATE_TIME datetime,
HITS integer,
NEWS_CLASS_ID integer,
NEWS_TYPE_ID integer,
PIC varchar(50),
RECOMMEND tinyint,
VALID tinyint,
TEMPLATE_ID integer not null,
primary key (NEWS_ID)
)
comment = "新闻"
type = InnoDB;/*==============================================================*/
/* Index: "FK_NEWS_CLASS_ID_FK" */
/*==============================================================*/
//错误出在这里You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(NEWS_CLASS_ID)' at line 2create index FK_NEWS_CLASS_ID_FK (
NEWS_CLASS_ID
);
/*==============================================================*/
/* Index: "FK_NEWS_TYPE_ID_FK" */
/*==============================================================*/
create index FK_NEWS_TYPE_ID_FK
(
NEWS_TYPE_ID
);
/*==============================================================*/
/* Index: "FK_TEMPLATE_ID_FK" */
/*==============================================================*/
create index FK_TEMPLATE_ID_FK
(
TEMPLATE_ID
);/*==============================================================*/
/* Index: INDEX_NEWS_ID */
/*==============================================================*/
create index INDEX_NEWS_ID on NEWS
(
NEWS_ID
);/*==============================================================*/
/* Table: TEMPLATE */
/*==============================================================*/
create table TEMPLATE
(
TEMPLATE_ID integer not null AUTO_INCREMENT,
TITLE varchar(20),
CONTENT text,
primary key (TEMPLATE_ID)
)
comment = "模板"
type = InnoDB;/*==============================================================*/
/* Table: USER */
/*==============================================================*/
create table USER
(
USER_ID int not null AUTO_INCREMENT,
USER_NAME varchar(20) not null,
PASSWORD varchar(50),
NAME varchar(20),
SEX_ID tinyint,
QUESTION varchar(50),
ANSWER varchar(50),
ABOUT varchar(200),
COUNTRY integer,
PROVINCE integer,
CITY integer,
ADDRESS varchar(50),
ZIP varchar(6),
TEL varchar(16),
EMAIL varchar(30) not null,
LEVEL tinyint,
IS_CHECK tinyint,
IS_LOCK tinyint,
REGISTER_DATE date,
LAST_LOG_TIME datetime,
END_DATE date,
primary key (USER_ID)
)
comment = "用户"
type = InnoDB;/*==============================================================*/
/* Index: "FK_SEX_ID_FK" */
/*==============================================================*/
create index FK_SEX_ID_FK
(
SEX_ID
);/*==============================================================*/
/* Index: INDEX_USER_USER_NAME */
/*==============================================================*/
create unique index INDEX_USER_USER_NAME on USER
(
USER_NAME
);/*==============================================================*/
/* Index: INDEX_USER_EMAIL */
/*==============================================================*/
create unique index INDEX_USER_EMAIL on USER
(
EMAIL
);alter table NEWS add constraint PK_NEWS_CLASS_ID foreign key (NEWS_CLASS_ID)
references DIC_NEWS_CLASS (NEWS_CLASS_ID) on delete restrict on update restrict;alter table NEWS add constraint FK_FK_NEWS_TYPE_ID foreign key (NEWS_TYPE_ID)
references DIC_NEWS_TYPE (NEWS_TYPE_ID) on delete restrict on update restrict;alter table NEWS add constraint FK_FK_TEMPLATE_ID foreign key (TEMPLATE_ID)
references TEMPLATE (TEMPLATE_ID) on delete restrict on update restrict;alter table USER add constraint FK_FK_SEX_ID foreign key (SEX_ID)
references DIC_SEX (SEX_ID) on delete restrict on update restrict;
/* DBMS name: MySQL 4.0 */
/* Created on: 2006-9-29 22:23:48 */
/*==============================================================*/
drop table if exists DIC_NEWS_CLASS;drop table if exists DIC_NEWS_TYPE;drop table if exists DIC_SEX;drop table if exists NEWS;drop table if exists TEMPLATE;drop table if exists USER;/*==============================================================*/
/* Table: DIC_NEWS_CLASS */
/*==============================================================*/
create table DIC_NEWS_CLASS
(
NEWS_CLASS_ID integer not null AUTO_INCREMENT,
NAME varchar(20),
ENG_NAME varchar(20),
primary key (NEWS_CLASS_ID)
)
comment = "新闻栏目"
type = InnoDB;/*==============================================================*/
/* Index: INDEX_NEWS_CLASS_ID */
/*==============================================================*/
create unique index INDEX_NEWS_CLASS_ID on DIC_NEWS_CLASS
(
NEWS_CLASS_ID
);/*==============================================================*/
/* Table: DIC_NEWS_TYPE */
/*==============================================================*/
create table DIC_NEWS_TYPE
(
NEWS_TYPE_ID integer not null AUTO_INCREMENT,
NAME varchar(20),
primary key (NEWS_TYPE_ID)
)
comment = "新闻类型"
type = InnoDB;/*==============================================================*/
/* Table: DIC_SEX */
/*==============================================================*/
create table DIC_SEX
(
SEX_ID tinyint not null,
NAME varchar(2),
primary key (SEX_ID)
)
type = InnoDB;/*==============================================================*/
/* Table: NEWS */
/*==============================================================*/
create table NEWS
(
NEWS_ID int not null AUTO_INCREMENT,
TITLE varchar(20),
URL varchar(50),
FILE_NAME varchar(20),
CONTENT text,
KEYWORD varchar(20),
author varchar(20),
FROM_WHERE varchar(20),
DATE_TIME datetime,
HITS integer,
NEWS_CLASS_ID integer,
NEWS_TYPE_ID integer,
PIC varchar(50),
RECOMMEND tinyint,
VALID tinyint,
TEMPLATE_ID integer not null,
primary key (NEWS_ID)
)
comment = "新闻"
type = InnoDB;/*==============================================================*/
/* Index: "FK_NEWS_CLASS_ID_FK" */
/*==============================================================*/
//错误出在这里You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(NEWS_CLASS_ID)' at line 2create index FK_NEWS_CLASS_ID_FK (
NEWS_CLASS_ID
);
/*==============================================================*/
/* Index: "FK_NEWS_TYPE_ID_FK" */
/*==============================================================*/
create index FK_NEWS_TYPE_ID_FK
(
NEWS_TYPE_ID
);
/*==============================================================*/
/* Index: "FK_TEMPLATE_ID_FK" */
/*==============================================================*/
create index FK_TEMPLATE_ID_FK
(
TEMPLATE_ID
);/*==============================================================*/
/* Index: INDEX_NEWS_ID */
/*==============================================================*/
create index INDEX_NEWS_ID on NEWS
(
NEWS_ID
);/*==============================================================*/
/* Table: TEMPLATE */
/*==============================================================*/
create table TEMPLATE
(
TEMPLATE_ID integer not null AUTO_INCREMENT,
TITLE varchar(20),
CONTENT text,
primary key (TEMPLATE_ID)
)
comment = "模板"
type = InnoDB;/*==============================================================*/
/* Table: USER */
/*==============================================================*/
create table USER
(
USER_ID int not null AUTO_INCREMENT,
USER_NAME varchar(20) not null,
PASSWORD varchar(50),
NAME varchar(20),
SEX_ID tinyint,
QUESTION varchar(50),
ANSWER varchar(50),
ABOUT varchar(200),
COUNTRY integer,
PROVINCE integer,
CITY integer,
ADDRESS varchar(50),
ZIP varchar(6),
TEL varchar(16),
EMAIL varchar(30) not null,
LEVEL tinyint,
IS_CHECK tinyint,
IS_LOCK tinyint,
REGISTER_DATE date,
LAST_LOG_TIME datetime,
END_DATE date,
primary key (USER_ID)
)
comment = "用户"
type = InnoDB;/*==============================================================*/
/* Index: "FK_SEX_ID_FK" */
/*==============================================================*/
create index FK_SEX_ID_FK
(
SEX_ID
);/*==============================================================*/
/* Index: INDEX_USER_USER_NAME */
/*==============================================================*/
create unique index INDEX_USER_USER_NAME on USER
(
USER_NAME
);/*==============================================================*/
/* Index: INDEX_USER_EMAIL */
/*==============================================================*/
create unique index INDEX_USER_EMAIL on USER
(
);alter table NEWS add constraint PK_NEWS_CLASS_ID foreign key (NEWS_CLASS_ID)
references DIC_NEWS_CLASS (NEWS_CLASS_ID) on delete restrict on update restrict;alter table NEWS add constraint FK_FK_NEWS_TYPE_ID foreign key (NEWS_TYPE_ID)
references DIC_NEWS_TYPE (NEWS_TYPE_ID) on delete restrict on update restrict;alter table NEWS add constraint FK_FK_TEMPLATE_ID foreign key (TEMPLATE_ID)
references TEMPLATE (TEMPLATE_ID) on delete restrict on update restrict;alter table USER add constraint FK_FK_SEX_ID foreign key (SEX_ID)
references DIC_SEX (SEX_ID) on delete restrict on update restrict;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货