`

数据库设计

阅读更多
/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     2011-9-16 14:38:02                           */
/*==============================================================*/


drop table if exists appointment;

drop table if exists card_info;

drop table if exists customer_info;

drop table if exists tb_record;

/*==============================================================*/
/* Table: appointment                                           */
/*==============================================================*/
create table appointment
(
   id                   int not null auto_increment,
   app_time             timestamp,
   ca_id                int comment '卡号',
   name                 varchar(50),
   parents              varchar(50),
   phone                varchar(50),
   primary key (id)
);

/*==============================================================*/
/* Table: card_info                                             */
/*==============================================================*/
create table card_info
(
   ca_id                int not null auto_increment,
   ca_num               varchar(50),
   cid                  int not null,
   ca_type              varchar(50),
   comments             varchar(200),
   primary key (ca_id)
);

/*==============================================================*/
/* Table: customer_info                                         */
/*==============================================================*/
create table customer_info
(
   cid                  int not null auto_increment,
   create_date          timestamp,
   baby_name            varchar(50) not null,
   nickname             varchar(50),
   parents_name         varchar(50),
   phone                varchar(50),
   primary key (cid, baby_name)
);

alter table customer_info comment '客户信息表';

/*==============================================================*/
/* Table: tb_record                                             */
/*==============================================================*/
create table tb_record
(
   rid                  int not null auto_increment,
   rec_date             timestamp,
   consumer_type        int comment '消费类型  0体验价   1刷卡',
   cid                  int comment '客户id',
   ca_id                int comment 'card id',
   swim_time            timestamp,
   swim_division        varchar(50) comment '游泳师',
   primary key (rid)
);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics