码迷,mamicode.com
首页 > 其他好文 > 详细

项目表结构

时间:2017-09-15 12:13:10      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:image   disco   def   drop   enc   sum   sqlyog   into   order   

一共4张表,如图

技术分享

 

sql语句如下:

/*
SQLyog 企业版 - MySQL GUI v8.14 
MySQL - 5.6.24 : Database - vip
*********************************************************************
*/


/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=‘‘*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=‘NO_AUTO_VALUE_ON_ZERO‘ */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`vip` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `vip`;

/*Table structure for table `tbl_sys_user` */

DROP TABLE IF EXISTS `tbl_sys_user`;

CREATE TABLE `tbl_sys_user` (
  `id` char(32) NOT NULL,
  `account` varchar(32) NOT NULL,
  `name` varchar(32) NOT NULL,
  `password` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `tbl_sys_user` */

insert  into `tbl_sys_user`(`id`,`account`,`name`,`password`) values (1,admin,admin,admin);

/*Table structure for table `tbl_vip_consume` */

DROP TABLE IF EXISTS `tbl_vip_consume`;

CREATE TABLE `tbl_vip_consume` (
  `id` char(32) NOT NULL,
  `vip_id` char(32) DEFAULT NULL,
  `whens` datetime DEFAULT NULL,
  `orderno` varchar(32) DEFAULT NULL,
  `amount` int(11) DEFAULT NULL COMMENT 消费金额,以分为单位,
  `operator_id` char(32) DEFAULT NULL,
  `remark` varchar(256) DEFAULT NULL,
  `flag` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_tbl_vip_consume` (`vip_id`),
  CONSTRAINT `FK_tbl_vip_consume` FOREIGN KEY (`vip_id`) REFERENCES `tbl_vip_detail` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `tbl_vip_consume` */

insert  into `tbl_vip_consume`(`id`,`vip_id`,`whens`,`orderno`,`amount`,`operator_id`,`remark`,`flag`) values (1,1,2017-07-07 00:00:00,10001,50,10001,NULL,NULL);

/*Table structure for table `tbl_vip_detail` */

DROP TABLE IF EXISTS `tbl_vip_detail`;

CREATE TABLE `tbl_vip_detail` (
  `id` char(32) NOT NULL,
  `code` varchar(32) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  `sex` tinyint(1) DEFAULT NULL,
  `age` tinyint(4) DEFAULT NULL,
  `qq` varchar(32) DEFAULT NULL,
  `email` varchar(32) DEFAULT NULL,
  `address` varchar(128) DEFAULT NULL,
  `zip` varchar(16) DEFAULT NULL,
  `remark` varchar(256) DEFAULT NULL,
  `rank` tinyint(1) DEFAULT NULL,
  `account` int(11) DEFAULT NULL COMMENT 消费金额,单位分,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `tbl_vip_detail` */

insert  into `tbl_vip_detail`(`id`,`code`,`name`,`sex`,`age`,`qq`,`email`,`address`,`zip`,`remark`,`rank`,`account`) values (1,10001,Tom,1,22,10002200,123@sina.com,beijing,NULL,NULL,1,50);

/*Table structure for table `tbl_vip_rank` */

DROP TABLE IF EXISTS `tbl_vip_rank`;

CREATE TABLE `tbl_vip_rank` (
  `no` tinyint(1) DEFAULT NULL,
  `name` varchar(32) DEFAULT NULL,
  `needAmount` int(11) DEFAULT NULL,
  `remark` varchar(128) DEFAULT NULL,
  `discount` tinyint(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `tbl_vip_rank` */

insert  into `tbl_vip_rank`(`no`,`name`,`needAmount`,`remark`,`discount`) values (1,普通VIP,1,NULL,98),(2,黄金VIP,100,NULL,95),(3,白金VIP,1000,NULL,90),(4,钻石VIP,5000,NULL,88),(5,终生VIP,10000,NULL,85);

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

 

项目表结构

标签:image   disco   def   drop   enc   sum   sqlyog   into   order   

原文地址:http://www.cnblogs.com/xpawn/p/7521425.html

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