Click here to Skip to main content
15,031,162 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

Table name is DEPT
DEPTNO   DNAME      LOC
10       ACCOUNT     UK
20       ANALYST     US
30       RESEARCH    JAPAN
Posted
Updated 28-Jan-15 2:30am
v2
Comments
CHill60 28-Jan-15 8:29am
   
Don't SHOUT! It's considered rude
ZurdoDev 28-Jan-15 8:29am
   
Please do not use all CAPS. It is considered shouting and rude.

You cannot join them if there is nothing to join on otherwise you get a cross join. What output do you want?

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[^].
   
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[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900