zoukankan      html  css  js  c++  java
  • 京东网站建表案例

    表设计

    建表语句

    品类表

    use shop;

    create table t_group(

    id int unsigned not null primary key auto_increment comment'主键',

    g_id int unsigned not null comment'品类编号',

    `name` varchar(200) not null default '' comment'品类名称',

    unique index uniq_g_id(g_id),

    unique index uniq_name(`name`),

    index index_g_id(g_id)

    )comment='品类表';

    参数表

    create table t_params(

    id int UNSIGNED primary key comment '主键',

    p_id int UNSIGNED not null comment '参数id--第几个参数',

    g_id int UNSIGNED not null comment '品类编号',

    `name` varchar(200) not null comment '参数名称',

    `numeric` boolean not null comment '是否是数字参数',

    unit varchar(200) comment '单位(量词)',

    generic boolean not null comment '是否重要参数',

    searching boolean not null comment '是否可以搜索到',

    segements varchar(500) comment '参数值',

    index idx_p_id(p_id),

    index idx_g_id(g_id)

    )comment='参数表';

    品牌表

    use shop;

    create table t_brand(

    id int unsigned primary key auto_increment comment'主键',

    `name` varchar(200) not null comment'品牌名称',

    image varchar(500) default null comment'图片地址',

    unique index uniq_name(`name`)

    )comment='品牌表';

    分类表

    create table t_category(

    id int unsigned primary key auto_increment comment'主键',

    `name` varchar(200) not null comment'分类名称',

    parent_id int unsigned default null comment'上级分类id',

    if_parent boolean not null comment'是否有下级',

    sort int unsigned not null comment'排名权重',

    index inx_parent_id(parent_id),

    index idx_sort(sort)

    )comment='分类表';

    品牌和分类联合表

    create table t_category_brand(

    category_id int unsigned not null comment'分类id',

    brand_id int unsigned not null comment'品牌id',

    primary key(category_id, brand_id)

    )comment='分类品牌联合表';

     

    spu产品表

    create table t_spu(

    id int unsigned primary key auto_increment comment'主键',

    title varchar(200) not null comment'标题',

    sub_title varchar(200) default null comment'副标题',

    brand_id int unsigned not null comment'品类id',

    category_id int unsigned not null comment'分类id',

    group_id int unsigned not null comment'品类id',

    saleable boolean not null comment'是否上架',

    valid boolean not null comment'是否有效',

    -- NOW()是时间函数 timestamp是时间类型

    create_time timestamp not null default NOW() comment'添加时间',

    last_update_time timestamp not null default NOW() comment'最后添加时间',

    index idx_brand_id(brand_id),

    index idx_category_id(category_id),

    index idx_ground_id(group_id),

    index idx_saleable(saleable),

    index idx_valid(valid)

    )comment='产品表';

    sku商品表

    create table t_sku(

    id int unsigned primary key auto_increment comment'主键',

    sku_id varchar(32) not null default '' comment'流水号',

    spu_id int unsigned not null comment'spuid商品id',

    title varchar(200) not null comment'标题',

    sub_title varchar(200) not null comment'副标题',

    images json default null comment'商品图片',

    price DECIMAL(10, 2) unsigned not null comment'商品价格',

    params json not null comment'参数',

    saleable boolean not null comment'是否上架',

    valid boolean not null comment'是否有效',

    create_time timestamp not null default NOW() comment'添加时间',

    last_update_time timestamp not null default NOW() comment'最后修改时间',

    index idx_spu_id(spu_id),

    index idx_saleable(saleable),

    index idx_valid(valid)

    )comment='商品表';

    数据库模型

  • 相关阅读:
    Adapter的泛型
    Xamarin 页面跳转
    NIPS(Conference and Workshop on Neural Information Processing Systems)
    CVPR(IEEE Conference on Computer Vision and Pattern Recognition)
    Layer Normalization
    Using Fast Weights to Attend to the Recent Past
    A Deep Compositional Framework for Human-like Language Acquisition in Virtual Environment
    Ubuntu之No module named cv2
    Photoshop脚本之eps转换成jpg
    Temporal Ensembling for Semi-Supervised Learning
  • 原文地址:https://www.cnblogs.com/HelloM/p/13545364.html
Copyright © 2011-2022 走看看