码迷,mamicode.com
首页 > 数据库 > 详细

010 数据库设计 - bos

时间:2017-08-16 19:21:32      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:_id   end   code   address   post   exists   ons   update   and   

/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2017/8/15 16:19:44 */
/*==============================================================*/


drop table if exists bc_decidedzone;

drop table if exists bc_region;

drop table if exists bc_staff;

drop table if exists bc_subarea;

/*==============================================================*/
/* Table: bc_decidedzone */
/*==============================================================*/
create table bc_decidedzone
(
id varchar(32) not null,
name varchar(30),
staff_id varchar(32),
primary key (id)
);

/*==============================================================*/
/* Table: bc_region */
/*==============================================================*/
create table bc_region
(
id varchar(32) not null,
province varchar(50),
city varchar(50),
district varchar(50),
postcode varchar(50),
shortcode varchar(30),
citycode varchar(30),
primary key (id)
);

/*==============================================================*/
/* Table: bc_staff */
/*==============================================================*/
create table bc_staff
(
id varchar(32) not null,
name varchar(20),
telephone varchar(20),
haspda char(1),
deltag char(1),
station varchar(40),
standard varchar(100),
primary key (id)
);

/*==============================================================*/
/* Table: bc_subarea */
/*==============================================================*/
create table bc_subarea
(
id varchar(32) not null,
decidedzone_id varchar(32),
region_id varchar(32),
addresskey varchar(100),
startnum varchar(30),
endnum varchar(30),
single char(1),
position varchar(255),
primary key (id)
);

alter table bc_decidedzone add constraint FK_decidedzone_staff foreign key (staff_id)
references bc_staff (id) on delete restrict on update restrict;

alter table bc_subarea add constraint FK_area_decidedzone foreign key (decidedzone_id)
references bc_decidedzone (id) on delete restrict on update restrict;

alter table bc_subarea add constraint FK_area_region foreign key (region_id)
references bc_region (id) on delete restrict on update restrict;

 

010 数据库设计 - bos

标签:_id   end   code   address   post   exists   ons   update   and   

原文地址:http://www.cnblogs.com/tommychok/p/7374980.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!