日期:2014-05-16 浏览次数:20580 次
1、创建database link
create database link oracle_test_link connect to oracle_test identified by zhouxufeng using 'orcl';
?2、创建同义词
create synonym emp_syn for emp@oracle_test_link; create synonym logs_syn for logs@oracle_test_link;
?3、创建表
create table emp as select * from emp_syn; create table logs as select * from logs_syn; create table dep( dep_id number primary key, dep_name varchar2(50) not null, dep_address varchar2(50) )
?4、Oracle中的DDL语句
--在表中增加一列 alter table emp add(emp_dep_id number); --更改列的类型 alter table emp modify(emp_name varchar(200)); --更改列的名称 alter table emp rename column emp_name1 to emp_name;
?5、创建序列
create sequence emp_seq increment by 1 start with 1 maxvalue 9999 nocycle cache 10 create sequence logs_seq increment by 1 start with 1 maxvalue 9999 nocycle cache 10
?6、使用distinct来过滤重复数据
select distinct e.emp_name from emp e?
?