字段的修改.添加和删除 create table tf1( id int primary key auto_increment, x int, y int ); #修改 alter table tf1 modify x char(4) default''; alter table tf1 change y m char(4) default ''; #增加 alter table 表名 add 字段名 类型[(长度) 约束]; >:alter table student add name cha
主键(PRIMARY KEY) 主键在一个数据表中只能有唯一的一个,约束当前字段的值不能重复,且非空保证数据的完整性,也可以当做当前数据表的标识符用来查询(当做索引,唯一性索引的一种) 创建带主键的表 /*带主键*/ CREATE TABLE T( id int(11) not null primary key, name char(20) ); /*带复合主键*/ CREATE TABLE T( id int(11) not null , name char(20) not null, pri
MySQL入门(三) 字段的修改.添加.与删除 修改表字段使用alter table语句,谨记! create table tf1( id int primary key auto_increment, x int, y int ); # 修改 alter table tf1 modify x char(4) default ''; alter table tf1 change y m char(4) default ''; # 增加 mysql>: alter table 表名 add 字段名