(笔记)Mysql命令create table:创建数据表

 

create table命令用来创建数据表。

create table命令格式:create table <表名> (<字段名1> <类型1> [,..<字段名n> <类型n>]);

例如,建立一个名为MyClass的表:

字段名数字类型数据宽度是否为空是否主键自动增加默认值
id int 4 primary key auto_increment  
name char 20      
sex int 4     0
degree double 16      


mysql> create table MyClass(
    > id int(4) not null primary key auto_increment,
    > name char(20) not null,
    > sex int(4) not null default '0',
    > degree double(16,2));

posted on 2016-01-08 19:32  tdyizhen1314  阅读(887)  评论(0编辑  收藏  举报

导航