Learning immediately: https://edu.csdn.net/course/play/4364/77142?utm_source=blogtoedu
Domain integrity:
- DEFAULT
- NOT NULL
- CHECK - mySQL does not support, does not prevent the value does not meet the check constraint entering the column
- FOREIGN KEY
# 创建表时给指定列添加default约束
create table st
(
sid INT not null primary key auto_increasement
sname varchar(10)
subject varchar(20) default '软件工程'
entertime TIMESTAMP default now()
)
# 给已有表中指定列添加default约束
alter table 'TSubject' modify column Publisher varchar(20) default '清华大学出版社'
# 删除default约束
alter table 'TSubject' modify column Publisher varchar(20) default NULL