orcale 常用DDL 语句
来源:互联网 发布:电子海报制作软件 编辑:程序博客网 时间:2024/05/18 00:10
--查看用户表
select * from user_tables;
--查看表中列信息
select * from user_tab_columns where table_name='product';
--修改表
--1 增加列
alter table rui_test add age int;
alter table rui_test add birthday date default sysdate not null;
--2 增加虚拟列
alter table rui_test add (ave_num as (low+high)/2);
--3 修改列的长度
--4 修改数字列的精度
alter table rui_test modify id number(5);
--5 修改列的数据类型
alter table rui_test modify status char(15);
--6 修改列的默认值
alter table rui_test modify status default -1;
--7 删除列
alter table rui_test drop column status;
--8 添加CHECK约束
alter table rui_test add constraint order_staus_ck check (status in('A','B','C'));
--9 NOT NULL约束
alter table rui_test modify status constraint order_status_nn not null;
--10 FOREIGH KEY 约束
alter table rui_test add constraint order_status_fk references employees(employee_id);
--11 UNIQUE 约束
alter table rui_test add constraint order_status_uq unique (stauts);
--12 删除约束
alter table rui_test drop constraint order_status_uq;
--13 禁用约束
alter table rui_test disable constraint order_status_nn;
--14 启用约束
alter table rui_test enable constraint order_status_nn;
-- 15 重命名表
rename rui_ole to rui_new;
--16 向表中添加注释
comment on table rui_test status is '状态';
--17 截断表
truncate table rui_test;
0 0
- orcale 常用DDL 语句
- orcale 常用功能语句
- 常用DDL语句
- 常用oracle DDL语句
- 常用SQL DDL语句
- 常用的DDL语句
- 常用DDL语句汇总
- oracle常用DDL语句
- 常用DDL语句
- orcale数据库常用查询语句
- mysql 常用的 ddl 语句。
- mysql 常用 ddl 语句示例
- oracle ddl语句常用语句整理
- SQL 常用语句 DDL,DML,DCL
- MySql数据库常用DDL语句 | 黄乔国PHP
- DDL语句
- DDL语句
- DDL语句
- 将原先非随机对象重新定义随机对象数组
- redis 保存对象方法
- 深入理解HTTP协议
- markdown学习笔记
- 2.29
- orcale 常用DDL 语句
- Android 消息机制
- 读《C语言深度解剖》1
- 《实体解析与信息质量》-1.2.7 复习题
- Android Studio 慢吗?No!!你还不懂她···
- 樱园三舍319
- Flatten Binary Tree to Linked List--LeetCode
- IOS Method swizzling
- 网络协议规范大全