/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2019/10/18 15:31:22 */
/*==============================================================*/
drop table if exists cart;
drop table if exists category;
drop table if exists comment;
drop table if exists goods;
drop table if exists order_goods;
drop table if exists seller;
drop table if exists shop;
drop table if exists t_order;
drop table if exists user;
drop table if exists user_address;
drop table if exists userinfo;
/*==============================================================*/
/* Table: cart */
/*==============================================================*/
create table cart
(
tt_money decimal(10,2) not null,
user_id varchar(30) not null,
goods_id varchar(30) not null,
goods_num int not null,
primary key (user_id, goods_id)
);
/*==============================================================*/
/* Table: category */
/*==============================================================*/
create table category
(
goods_id varchar(40) not null,
c_name varchar(60) not null,
keywords varchar(160) not null,
title varchar(60) not null,
description varchar(600) not null,
c_id varchar(20) not null,
primary key (c_id)
);
/*==============================================================*/
/* Table: comment */
/*==============================================================*/
create table comment
(
user_id varchar(40) not null,
time datetime not null,
content varchar(500) not null,
co_id varchar(20) not null,
goods_id varchar(30),
primary key (co_id)
);
/*==============================================================*/
/* Table: goods */
/*==============================================================*/
create table goods
(
goods_id varchar(30) not null,
c_id varchar(20),
shop_id varchar(40),
main_title varchar(100) not null,
sub_title varchar(500),
price decimal(10,2) not null,
old_price decimal(10,2) not null,
goods_img varchar(100),
sell_num int not null,
detail varchar(500),
Stock int,
primary key (goods_id)
);
/*==============================================================*/
/* Table: order_goods */
/*==============================================================*/
create table order_goods
(
order_id varchar(30) not null,
goods_id varchar(30) not null,
goods_num int not null,
tt_money decimal(10,2) not null,
primary key (order_id, goods_id)
);
/*==============================================================*/
/* Table: seller */
/*==============================================================*/
create table seller
(
seller_id varchar(40) not null,
username varchar(80) not null,
password varchar(80) not null,
tel int not null,
sex varchar(5) not null,
real_name varchar(80) not null,
primary key (seller_id)
);
/*==============================================================*/
/* Table: shop */
/*==============================================================*/
create table shop
(
shop_id varchar(40) not null,
seller_id varchar(40),
shop_name varchar(200) not null,
address varchar(200) not null,
tel char(40) not null,
primary key (shop_id)
);
/*==============================================================*/
/* Table: t_order */
/*==============================================================*/
create table t_order
(
order_id varchar(30) not null,
user_id varchar(30),
total_money decimal(10,2) not null,
order_state varchar(10) not null,
order_time datetime not null,
primary key (order_id)
);
/*==============================================================*/
/* Table: user */
/*==============================================================*/
create table user
(
user_id varchar(30) not null,
inf_id varchar(40),
username varchar(80) not null,
password varchar(80) not null,
tel varchar(80) not null,
sex varchar(5),
real_name varchar(80) not null,
primary key (user_id)
);
/*==============================================================*/
/* Table: user_address */
/*==============================================================*/
create table user_address
(
real_name varchar(20) not null,
province varchar(20) not null,
city varchar(20) not null,
county varchar(20) not null,
street varchar(20) not null,
tel char(12) not null,
postcode char(12) not null,
address_id varchar(20) not null,
user_id varchar(30),
primary key (address_id)
);
/*==============================================================*/
/* Table: userinfo */
/*==============================================================*/
create table userinfo
(
inf_id varchar(40) not null,
user_id varchar(30),
balance decimal(10,2) not null,
intergral smallint not null,
primary key (inf_id)
);
一键复制
编辑
Web IDE
原始数据
按行查看
历史