用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - sql代码库

连接

2017-09-22 作者:举报

[sql]代码库

 create table author(
  aid char(4),
  aname varchar2(10),
  sex char(1)
 );
 --drop table author;
 create table aword(
  adate date,
  aid char(4)
 );
 --drop table prize_winner;
 insert into author values('1','join','1');
 insert into author values('2','karl','0');
 insert into author values('3','foul','0');
 insert into author values('4','jell','1');
 insert into aword
    select sysdate,'1' from dual union
    select sysdate-1,'4' from dual;
 select * from aword;
 select * from author where aid not in(select aid from aword);
 select * from author a where not exists(
    select 1 from aword b where b.aid=a.aid);
select a.* from author a left join aword b on a.aid=b.aid
    where b.aid is null;
--内连接
select * from author inner join aword on author.aid=aword.aid;
select * from aword inner join author on author.aid=aword.aid;
--左外连接
select * from author left join  aword on author.aid=aword.aid;
select * from aword left join author on author.aid=aword.aid;
--右外连接
select * from author right join aword on author.aid=aword.aid;
select * from aword right join author on author.aid=aword.aid;
--完全连接
select * from author full join aword on aword.aid=author.aid;


分享到:
更多

网友评论    (发表评论)

共1 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。