Home  >  Article  >  Database  >  oracle基础语法(一)

oracle基础语法(一)

WBOY
WBOYOriginal
2016-06-07 15:50:55999browse

create user draem0507 identified by test;--创建用户与密码 grant connect,resource to draem0507;--授权连接与处理事务的权限 conn draem0507/test;--以draem0507用户登录 /*创建新表*/ /*用as创建的表主要功能是导入表的数据*/ create table t_test as s

create user draem0507 identified by test;--创建用户与密码

grant connect,resource to draem0507;--授权连接与处理事务的权限

conn  draem0507/test;--以draem0507用户登录

/*创建新表*/

/*用as创建的表主要功能是导入表的数据*/

create table t_test as select   a.id,a.name new_name from t_test_old;

/*用like创建的表主要是导入表结构*/

select table t_test2 like t_test_old;--oracle不支持like。

 

/*删除表  drop */

drop table t_test  ; --删除整张表

 

delete table  t_test;--只是删除数据,并且可以恢复 truncate不可恢复

 

alter table t_test add (new_col type[,new_col2 type])--增加列

alter table t_test drop drop_col;--删除列

alter table t_test rename column old_name to new_col_name;--更改字段名

alter table t_test modify change_type_col newtype;--更改字段类型

alter table t_test add primary key(nno);--增加字段主键

alter table t_test drop primary key(nno);--删除字段主键

 

 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn