简单的商城系统的数据库设计

打印 上一主题 下一主题

主题 988|帖子 988|积分 2964

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
简单的商城系统的数据库设计

本文会详细介绍一下,简单商城系统的数据库的表的创建。
本文使用的数据库是MySQL8.0.x。
数据库可视化软件使用的是jetbrains datgrip。
用户相关

账号表
  1. create table account(
  2.     id int8 auto_increment primary key comment '主键',
  3.     username varchar(10) not null unique comment '账号',
  4.     `password` varchar(150) not null comment '密码',
  5.     nickname varchar(10) default null comment '昵称',
  6.     role_type varchar(1) default '0' comment '0 - 普通用户 1 - 管理员 2 - 超级管理员',
  7.     create_at datetime default current_timestamp comment '创建时间',
  8.     update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
  9. )comment '账号表';
复制代码
用户信息表
  1. create table userinfo(
  2.     id int8 auto_increment primary key comment '主键',
  3.     uid int8 not null comment '账号主键',
  4.     id_num varchar(18) comment '身份证号',
  5.     real_name varchar(10) comment '身份证姓名',
  6.     create_at datetime default current_timestamp comment '创建时间',
  7.     update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
  8. )comment '用户信息表';
复制代码
购物车表
  1. create table cart(
  2.     id int8 auto_increment primary key comment '主键',
  3.     uid int8 not null comment '账号主键',
  4.     `count` int comment '购物车中有几种类型的商品',
  5.     create_at datetime default current_timestamp comment '创建时间',
  6.     update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
  7. )comment '购物车表';
复制代码
收件地址表
  1. create table address(
  2.     id int8 auto_increment primary key comment '主键',
  3.     uid int8 not null comment '账号主键',
  4.     country varchar(30) default '中国' comment '国家',
  5.     province varchar(30) default '北京市' comment '省份/州',
  6.     city varchar(30) default '北京市' comment '市',
  7.     district varchar(30) default '东城区' comment '区/县',
  8.     detail varchar(150) not null comment '详细地址',
  9.     is_default varchar(1) default '0' comment '0 - 非默认收件地址 1 - 默认收件地址',
  10.     create_at datetime default current_timestamp comment '创建时间',
  11.     update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
  12. )comment '收件地址表';
复制代码
后面还会更新


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

涛声依旧在

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表