简单的商城系统的数据库设计
本文会详细介绍一下,简单商城系统的数据库的表的创建。
本文使用的数据库是MySQL8.0.x。
数据库可视化软件使用的是jetbrains datgrip。
用户相关
账号表
create table account(
id int8 auto_increment primary key comment '主键',
username varchar(10) not null unique comment '账号',
`password` varchar(150) not null comment '密码',
nickname varchar(10) default null comment '昵称',
role_type varchar(1) default '0' comment '0 - 普通用户 1 - 管理员 2 - 超级管理员',
create_at datetime default current_timestamp comment '创建时间',
update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
)comment '账号表';
用户信息表
create table userinfo(
id int8 auto_increment primary key comment '主键',
uid int8 not null comment '账号主键',
id_num varchar(18) comment '身份证号',
real_name varchar(10) comment '身份证姓名',
create_at datetime default current_timestamp comment '创建时间',
update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
)comment '用户信息表';
购物车表
create table cart(
id int8 auto_increment primary key comment '主键',
uid int8 not null comment '账号主键',
`count` int comment '购物车中有几种类型的商品',
create_at datetime default current_timestamp comment '创建时间',
update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
)comment '购物车表';
收件地址表
create table address(
id int8 auto_increment primary key comment '主键',
uid int8 not null comment '账号主键',
country varchar(30) default '中国' comment '国家',
province varchar(30) default '北京市' comment '省份/州',
city varchar(30) default '北京市' comment '市',
district varchar(30) default '东城区' comment '区/县',
detail varchar(150) not null comment '详细地址',
is_default varchar(1) default '0' comment '0 - 非默认收件地址 1 - 默认收件地址',
create_at datetime default current_timestamp comment '创建时间',
update_at datetime default current_timestamp on update current_timestamp comment '修改时间'
)comment '收件地址表';
后面还会更新
玄机博客
© 版权声明
1.本站内容仅供参考,不作为任何法律依据。用户在使用本站内容时,应自行判断其真实性、准确性和完整性,并承担相应风险。
2.本站部分内容来源于互联网,仅用于交流学习研究知识,若侵犯了您的合法权益,请及时邮件或站内私信与本站联系,我们将尽快予以处理。
3.本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
4.根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。
5.本站是非经营性个人站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途
THE END
暂无评论内容