mysql创建文章表_创建表--文章表article

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

表名

表字段名

定义每个表字段

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

数据属性:

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

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

3. 自增 auto_increment ;

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

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

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

7. 描述 comment '描述内容' 。//文章表

create table article(

aid  int(8) unsigned  primary key auto_increment,

author varchar(45) not null default '',

title char(120) not null default '',

content text not null default '',

addtime datetime,

sort tinyint(1) unsigned not null default '255',

hot tinyint(1) unsigned not null default '1',

cid int(8) unsigned not null default 0

);

f2c177b451c04978e994e5e2ff9da97c.gif

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值