alter table book add column book_id varchar not null, book_title varchar(10) default '';
alter table book drop book_id, book_title;
// 外键时
alter table book drop book_id, book_title cascade;
alter table book alter column book_title type varchar;
alter table book rename column book_title to book_name;
alter table book add primary key(book_id);
alter table book drop constraint book_id;
// 唯一约束
alter table book add conversion book_id_unique unique(book_id);
// 非空约束
alter table book alter column book_title set not null;
// 删除唯一约束
alter table book drop constraint book_id_unique;
// 删除非空约束
alter table book alter column book_title drop constraint not null;
alter table book alter column book_title set default '无';
alter table book alter column book_title dorp default;
comment on table book is '书';
comment on column book.book_id is '书ID';
原文地址:https://blog.csdn.net/jl15988/article/details/134799273
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_50879.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!