首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

新建表sql语句

二、对表的修改 1.给表重命名 语法:alter table table_name rename to new_table_name; 例子:alter table student rename to new_student; 2.给表添加字段 语法:alter table tablename add (column datatype [default value][null/not null],….); 例子: alter table student add (teachername varchar2(30) default ‘张三’ not null); 3.修改表字段 语法:alter table tablename modify (column datatype [default value][null/not null],….); 例子:alter table student modify (teachername varchar2(30) default ‘张三’ not null); 4.删除表字段 语法:alter table tablename drop (column); 或者alter table tablename drop column column_name 例子:alter table student drop column teachername; 5.主键约束 添加有名称的主键约束:alter table table_name add constraint pk_name primary key (id); 删除有名称的主键约束:alter table table_name drop constraint pk_name; 6.修改表字段类型 例子:alter table student alter column birthday decimal(18, 4) not null

02
领券