在Oracle SQL Developer中联接表 [英] Joining Tables in Oracle SQL Developer

查看:168
本文介绍了在Oracle SQL Developer中联接表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有四个要联接的表并一起显示输出.我不确定Oracle SQL Developer的语法如何工作.我知道这对程序员来说是一个简单的问题,我希望有人可以对代码的外观提出建议.

I have four tables that I want to join and display the output all together. I'm not sure how the syntax works for Oracle SQL Developer. I know this is an easy question for a programmer and I was hoping someone can make a suggestion on how the code might look like.

是:

JNL1
JNL2
JNL3
JNL4

这四个表之间的通用键是ItemID.

The key that is common between all four of these tables is ItemID.

查询的外观如何?谢谢

推荐答案

这实际上取决于您想要哪种连接(外部连接与否),但是您可以使用默认的SQL语法.

It really depends on what kind of join you want (outer or not) but you can use default SQL syntax.

例如,不使用JOIN关键字加入:

For example, joining without the JOIN keyword:

select * from JNL1, JNL2, JNL3, JNL4,
where 
JNL1.ItemID = JNL2.ItemID AND
JNL2.ItemID = JNL3.ItemID AND
JNL3.ItemID = JNL4.ItemID;

此外,您可以使用多个INNER JOINS,例如

Additionally you can make use of multiple INNER JOINS e.g.

SELECT whatever
  FROM JNL1 AS a
INNER 
  JOIN JNL2 AS b
    ON b.ItemID = a.ItemID
INNER 
  JOIN JNL2 AS c
     ON c.ItemID = b.ItemID
INNER 
  JOIN JNL2 AS d
     ON d.ItemID = c.ItemID

这篇关于在Oracle SQL Developer中联接表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆