crebas.sql

来自「实现很多功能 实现很多功能 实现很多功能」· SQL 代码 · 共 64 行

SQL
64
字号
/*==============================================================*/
/* DBMS name:      MySQL 5.0                                    */
/* Created on:     6/21/2007 6:24:12 PM                         */
/*==============================================================*/


drop table if exists t_data_sale_flow;

drop table if exists t_dic_chain_store;

drop table if exists t_dic_product;

drop table if exists t_sys_user;

/*==============================================================*/
/* Table: t_data_sale_flow                                      */
/*==============================================================*/
create table t_data_sale_flow
(
   id                   bigint not null auto_increment,
   product_code         bigint comment '产品编号',
   store_code           bigint comment '连锁店编号',
   create_date          timestamp comment '创建日期',
   primary key (id)
);

/*==============================================================*/
/* Table: t_dic_chain_store                                     */
/*==============================================================*/
create table t_dic_chain_store
(
   id                   bigint not null comment '编号',
   name                 varchar(20) comment '名称',
   primary key (id)
);

/*==============================================================*/
/* Table: t_dic_product                                         */
/*==============================================================*/
create table t_dic_product
(
   id                   bigint not null comment '编号',
   name                 varchar(20) comment '产品名称',
   primary key (id)
);

/*==============================================================*/
/* Table: t_sys_user                                            */
/*==============================================================*/
create table t_sys_user
(
   id                   bigint not null auto_increment,
   username             varchar(50),
   password             varchar(50),
   primary key (id)
);

alter table t_data_sale_flow add constraint FK_sale_to_product foreign key (product_code)
      references t_dic_product (id) on delete restrict on update restrict;

alter table t_data_sale_flow add constraint FK_sale_to_store foreign key (store_code)
      references t_dic_chain_store (id) on delete restrict on update restrict;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?