Content

mysql创建表设置表主键id从1开始自增的解决方案(mysql的建表)怎么可以错过

文章摘要

这篇文章介绍了在数据库中定义的一个用户表信息表,用于存储微信用户的基本信息和属性。表名为`sys_user`,包含17个字段,字段类型均为`varchar`或`tinyint`,最大字段长度为256位。表中字段包括用户唯一的微信ID、账号名称、用户名、密码、昵称、性别、电话号码、角色(0为普通用户,1为会员)、年龄、状态、更新时间、创建时间、是否删除标志、邮箱、头像图片等。默认值方面,密码和头像图片字段为空或赋值默认值,其他字段如年龄默认为'110'。这篇文章突出了用户表的结构设计,以及各字段的作用和数据类型。

create table if not exists `sys_user` ( `id` bigint(20) not null auto_increment PRIMARY KEY comment ‘主键’ , `opend_id` varchar(256) DEFAULT null comment ‘微信用户唯一id’, `account_number` varchar(256) DEFAULT null comment’账号’, `username` varchar(256) not null DEFAULT ” comment ‘用户名’, `password` varchar(256) comment ‘密码’, `nick_name` varchar(256) DEFAULT null comment ‘昵称’, `gender` varchar(25) DEFAULT null comment ‘性别’, `phone` varchar(256) DEFAULT null comment ‘手机号’, `role` varchar(10) default ‘0’ not null comment ‘角色,0为普通用户,1为会员’, `age` varchar(256) not null DEFAULT’110’comment ‘年龄’, `user_status` varchar(25) default ‘0’ not null comment ‘状态’, `update_time` datetime not NULL DEFAULT CURRENT_TIMESTAMP comment ‘更新时间’, `create_time` datetime not NULL DEFAULT CURRENT_TIMESTAMP comment ‘创建时间’, `is_deleted` tinyint default 0 not null comment ‘是否删除(0-未删, 1-已删)’, `email` varchar(256) DEFAULT null comment ‘邮箱’, `avatar` varchar(256) not null DEFAULT ‘https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaG T4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132’ comment ‘头像图片’, `city` varchar(50) DEFAULT ‘北京’ comment ‘城市’, `province` varchar(50) DEFAULT null comment ‘省份’, `country` varchar(50) comment ‘国家’ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 comment ‘用户表信息’;