---
title: "数据库设计"
author: "rfv1116"
date: "2011-09-13T22:21:12Z"
tags: ["数据库"]
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2011-09-16T14:42:12Z"
id: 1171244
url: "https://rfv1116.iteye.com/blog/1171244"
---

/*==============================================================*/
/* 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)
);
