oracle数据库连接方式
数据库:Oracle
分类:数据库连接方式
--创建两个表
create table tmp1
(
id number(10) not null,
name varchar2(10) not null
);
create table tmp2
(
id number(10) not null,
age number(10) not null
);
--查询
select * from tmp1;
select * from tmp2;
--插入初始数据
insert into tmp1 (id,name) values (1,'张一');
insert into tmp1 (id,name) values (2,'张二');
insert into tmp1 (id,name) values (3,'张三');
insert into tmp1 (id,name) values (4,'张四');
insert into tmp2 (id,age) values (1,18);
insert into tmp2 (id,age) values (2,19);
insert into tmp2 (id,age) values (3,20);
insert into tmp2 (id,age) values (5,22);
--更改错误数据
select t.*,t.rowid from tmp2 t;
--查询 笛卡尔积 不加条件
select * from tmp1,tmp2;
--左连接
select * from tmp1 a left join tmp2 b on a.id=b.id;
--右连接
select * from tmp1 a right join tmp2 b on a.id=b.id;
--内连接
select * from tmp1 a inner join tmp2 b on a.id=b.id;
select * from tmp1 a,tmp2 b where a.id=b.id;
--全连接
select * from tmp1 a full join tmp2 b on a.id=b.id;