如何加入两个表? [英] How to join two tables?
本文介绍了如何加入两个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设两个表都不是普通字段并且没有任何关系......你怎么能加入那两个表..?
表名是EMP
Suppose if both table do not common field and don't have any relation......how can you join that two tables..?
Table name is EMP
EMPNO NAME JOB
1 SAM CLERK
2 RAM ACCOUNT
3 PRABU CLERK
4 RAJ MANAGER
表名是DEPT
Table name is DEPT
DEPTNO DNAME LOC
10 ACCOUNT UK
20 ANALYST US
30 RESEARCH JAPAN
推荐答案
您不希望加入两个没有任何共同点的表格。 />
你仍然可以做的是一个CROSS-JOIN,它将列出所有行的组合 - CROSS-JOIN [ ^ ]。
You would not want to join two tables that have nothing in common.
What you can still do is a CROSS-JOIN that will list out all combination of rows - CROSS-JOIN[^].
员工肯定必须属于某些部门,他们是empl oyees。所以在emp表中添加一个deptno列并将其链接到dept表中的deptno,现在你就拥有了这个关系。
阅读更多:数据库设计简介 [ ^ ]
Employees surely have to belong to some departments else they are employees. So add a column "deptno" in the "emp" table and link it to the "deptno" in the "dept" table, and now you have the relationship.
Read more: Introduction to database design[^]
这篇关于如何加入两个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文