当前位置:Gxlcms > 数据库问题 > 模仿ecshop建立木瓜商城数据库(MySQL)

模仿ecshop建立木瓜商城数据库(MySQL)

时间:2021-07-01 10:21:17 帮助过:24人阅读

1. 安装ecshop(打开gd扩展)

2. 使用图形化界面工具,如phpmyadmin查看数据。(以前用命令行,主要锻炼代码熟练度!)

 

# 建木瓜库

create database mugua charset utf8;

 

# 选中木瓜

use mugua;

 

# 创建商品表(创建的字段应和ecshop里的一样,并且一一对应)

create table goods(
goods_id int primary key auto_increment,
cat_id smallint not null default 0,
goods_sn char(15) not null default ‘‘,
goods_name varchar(30) not null default ‘‘,
click_count mediumint unsigned not null default 0,
brand_id smallint not null default 0,
goods_number smallint not null default 0,
market_price decimal(7, 2) not null default 0.00,
shop_price decimal(7,2) not null default 0.00,
add_time int unsigned not null default 0
)charset utf8;

 

# 把ec的商品数据导入到木瓜库

insert into mugua.goods
select
goods_id, cat_id, goods_sn, goods_name, click_count,
brand_id, goods_number, market_price,
shop_price,
add_time
from shop.goods;

 

# 创建类目表

create table category(
cat_id smallint primary key auto_increment,
cat_name varchar(30) not null default ‘‘,
parent_id smallint not null default 0
)charset utf8;

 

# 把ec的类目数据导入到木瓜库

insert into mugua.category
select
cat_id, cat_name, parent_id
from shop.category;

 

# 创建品牌表

create table brand(
brand_id smallint primary key auto_increment,
brand_name varchar(30) not null default ‘‘
)charset utf8;

 

# 把ec的品牌数据导入到木瓜库

insert into mugua.brand
select
brand_id, brand_name
from shop.brand;

 

模仿ecshop建立木瓜商城数据库(MySQL)

标签:time   安装   bsp   ber   arch   and   medium   admin   使用   

人气教程排行