商城mysql表_商城数据库建表

本文介绍了数据库设计中关于商品管理的部分,包括创建商品类型表(i_type),用于存储商品类型的ID和名称,并设置了索引。接着是商品属性表(it_attribute),包含类型ID、属性名称、属性类型、输入方式和默认值,为快速查询提供了索引。此外,还提到了栏目管理的栏目表(yd_category),用于存储栏目ID、栏目名称以及父级栏目ID,构建了网站的栏目结构。
摘要由CSDN通过智能技术生成

商品类型管理:

先要创建商品类型的表,用来存储商品类型的信息。

create table i_type(

id tinyint unsigned primary key auto_increment,

type_name varchar(32) not null comment '商品类型的名称',

index (type_name)

)engine myisam charset utf8;

商品的属性表:

create table it_attribute(

id tinyint unsigned primary key auto_increment,

type_id tinyint not null comment '商品类型的id',

attr_name varchar(32) not null comment '属性的名称',

attr_type tinyint  not null default 0 comment '属性的类型,0:表示唯一属性,1则表示是单选属性',

attr_input_type  tinyint  not null default 0 comment '属性值的输入方式 0:表示手工输入,1则是列表选择',

attr_value varchar(64) not null default '' comment '属性的默认值,列表选择使用',

index (type_id)

)engine myisam charset utf8;

栏目管理

栏目表:

create table yd_category(

id smallint unsigned primary key auto_increment,

cat_name varchar(32) not null comment '栏目的名称',

parent_id smallint unsigned not null default 0 comment '父级栏目的id'

)engine myisam charset utf8;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值