comments.php,创建表--评论表comments

建MySQL数据表需要以下信息:

表名

表字段名

定义每个表字段

`字段名`  数据类型  数据属性

数据属性:

1. 无符号 unsigned(非负限定 ,即不能取负值) 取值范围 0–255;

2. 主键索引 primary key(唯一,一张表推荐一个主键) ;

3. 自增 auto_increment ;

4. 唯一索引 unique(唯一) 主要目的 : 避免数据重复 , 附带提高查询速度 ,缺点 : 占用磁盘空间 ;

5. 非空约束 not null (不能为空) ;

6. 默认值 default 值 注: 数据属性不写, 默认为 null;

7. 描述 comment '描述内容' 。//评论表

create table comments(

com_id int(8) unsigned primary key auto_increment comment '评论id',

nickname varchar(45) not null default '' comment '昵称',

content text not null default '' comment '评论内容',

ip varchar(20) default null comment '评论id地址',

addtime int(10) unsigned default null comment '评论时间',

state tinyint(1) unsigned not null default 0 comment '是否显示',

aid int(8) unsigned default null comment '评论文章id'

) comment='评论表';

f2c177b451c04978e994e5e2ff9da97c.gif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值