Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Please let me know if UNION ALL and Natural Join does the
same operation and are same...

Answers were Sorted based on User's Feedback



Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / vasanth

Hi All....!

Natural join is the same as an equi join on (emp.deptno =
dept.deptno).

Natural joins may cause problems if columns are added or
renamed. Also, no more than two tables can be joined using
this method. So, it is best to avoid natural joins as far
as possible.

If you will come to UNION ALL.

UNION ALL query allows you to combine the result sets of 2
or more "select" queries. It returns all rows (even if the
row exists in more than one of the "select" statements.

Each SQL statement within the UNION ALL query must have the
same number of fields in the result sets with similar data
types.

For Example :-

select field1, field2, . field_n
from tables
UNION ALL
select field1, field2, . field_n
from tables;

Is This Answer Correct ?    18 Yes 3 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / vasanth

Natural Join and UNION ALL won't give same results.

Is This Answer Correct ?    15 Yes 6 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / vikneswaran

no,union all and natural join is not same. for example tave
two tame emp and dept

emp table

empid ename salary
1 a 1000
2 b 2000

dept table
deptid deptno
1 10
2 20
if i join this two tables
(empid = deptid)

empid ename salary deptno
1 a 1000 10
2 b 2000 20

if i union a11 this two tables

empid ename salary deptno
1 a 1000 null
2 b 2000 null
1 null null 10
2 null null 20
so join and unionall is not same

Is This Answer Correct ?    9 Yes 3 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / subathra

union all: Joins the 2 selected results based on different
conditions.

Example:
select a.emp_id, b.dept_id from
emp a, dept b
where a.dept_id=b.dept_id
and a.sal < 3000
union all
select a.emp_id, b.dept_id from
emp a, dept b
where a.dept_id=b.dept_id
and a.sal > 6000


Natural Join: Establish the condition between 2 or more
tables.

Example: select a.emp_id, b.dept_id from
emp a, dept b
where a.dept_id=b.dept_id

Is This Answer Correct ?    2 Yes 1 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / g.srinivasulu

Both are not same why because in UNION ALL operator can
retrive the total number of records from the table and
NATUAL JOIN OR EQUI JOIN operator retrive the rows which
are condition must be the same and datatype of the column
names must be same...

Is This Answer Correct ?    1 Yes 1 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / swathi

no,both are not same.we are using the union all condition ,we will get the duplicate columns and which field we are selecting it get the total information of that ,But by using Natural join we can't get the all information,some columns are removed.

Is This Answer Correct ?    0 Yes 1 No

Please let me know if UNION ALL and Natural Join does the same operation and are same.....

Answer / brahma

both are return same result

Is This Answer Correct ?    4 Yes 13 No

Post New Answer



More SQL PLSQL Interview Questions

why we use nocopy?

2 Answers   Polaris,


What is the best sql course?

0 Answers  


Explain the uses of database trigger.

0 Answers  


create a store procedure and created synonms for that store procedure after modify that store procedure will effect on synonms? If we delete the store procedure what happened to that synonms?

2 Answers   Polaris,


what are the performance and scalability characteristics of mysql? : Sql dba

0 Answers  






Which join is default?

0 Answers  


what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba

0 Answers  


What do you understand by pl/sql cursors?

0 Answers  


Why plvtab is considered as the easiest way to access the pl/sql table?

0 Answers  


Which sql statement is used to delete data from a database?

0 Answers  


Cite the differences between execution of triggers and stored procedures?

0 Answers  


Explain what is an index?

0 Answers  






Categories