当前位置:网站首页>oracle对表字段的修改
oracle对表字段的修改
2022-04-23 06:05:00 【旺财2】
主要操作:1.添加字段;2.删除字段;3.修改字段(修改字段的类型,修改字段的长度)
1.添加字段:
总是可以成功,新添加的字段出现在表的最后面。
alter table student
add tel varchar2(11);
alter table student
add addr varchar2(11);
2.删除字段:
总是可以成功,不管是否有数据,都可以删除掉。
alter table student
drop column addr
3.修改字段:
A.在该字段没有数据的时候,字段的类型,字段的长度都是可以修改的。
alter table student
modify tel number(11);
alter table student
modify addr varchar(20);
B.对于缺省值的修改,不会影响已经存在的数据,只会对以后插入的数据产生影响。
alter table student
modify sex char(2) default '女';
C.当该字段有数据的时候字段的类型是不能修改的,但是字段的长度是可以修改的(长度增大可以,变小要看数据的实际长度)。
alter table student
modify grade varchar(8);
版权声明
本文为[旺财2]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wdyliuxingfeiyang/article/details/121513079
边栏推荐
猜你喜欢

阿里云日志服务sls的典型应用场景

Detailed explanation of RDMA programming

Implementation of multi tenant read and write in Prometheus cortex

Winter combat camp hands-on combat - MySQL database rapid deployment practice lead mouse cloud Xiaobao

Prometheus thanos Quick Guide

Virtio and Vhost_ Net introduction

Apache Atlas 编译及安装记录

冬季实战营 动手实战-MySQL数据库快速部署实践 领鼠标 云小宝

Redis FAQ

Thanos Compact组件测试总结(处理历史数据)
随机推荐
Abnormal record-15
Ansible basic commands, roles, built-in variables and tests judgment
prometheus告警记录持久化(历史告警保存与统计)
Django::Did you install mysqlclient?
阿里云日志服务sls的典型应用场景
[shell script exercise] batch add the newly added disks to the specified VG
try catch 不能捕获异步错误
微服务架构核心概念
专用窗口函数rank, dense_rank, row_number
RAC环境数据库节点参数设置不当导致监听无法连接问题排查
ORACLE环境遇到的ORA-600 [qkacon:FJswrwo]
异常记录-11
Abnormal record-11
异常记录-16
几款电纸书阅读器参数对比
Practice using polardb and ECs to build portal websites
js 函数包裹forEach中使用return跳不出外层函数
Abnormal record-19
异常记录-15
Apache SeaTunnel 2.1.0部署及踩坑