摘要:
主键的作用: 可以唯一标识 一条数据,每张表里面只能有一个主键,。主键特性: 非空且唯一。当表里没有主键的时,第一个出现的非空且为唯一的列,被当成主键。 例子:create table tb3( id int primary key, name varchar(20) not null); 唯一标识 阅读全文
摘要:
例子:create table tb1( id int, name varchar(20) not null); 注意 空字符不等于null #手动,添加非空约束 (必须这个字段,没有NULL值)mysql> alter table tb1 -> modify id int not null; # 阅读全文