mysql約束取值范圍 創(chuàng)建表時(shí)mysql添加唯一約束條件?
創(chuàng)建表時(shí)mysql添加唯一約束條件?Trycreate table user(id int not null auto uuu Increase,name varchar(100)not null,p
創(chuàng)建表時(shí)mysql添加唯一約束條件?
Try
create table user
(
id int not null auto uuu Increase,
name varchar(100)not null,
password varchar(100)not null,
primary key(id),
unique key(name)
]事實(shí)上,這與您的MySQL版本有關(guān),語(yǔ)法會(huì)有所不同
你可以下載mysqlbrowser的圖形界面,然后通過(guò)圖形方式生成語(yǔ)句
一般來(lái)說(shuō),檢查約束都是建立起來(lái)的。例如,列sex的值只能設(shè)置為“male”或“female”
創(chuàng)建表tab10時(shí),命令是create table0(sex char(2)check(sex in(“male”,“female”)。