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

What is the purpose of the sql select top clause?

0 Answers  


what is msql? : Sql dba

0 Answers  


what is the difference between union and union all? : Sql dba

0 Answers  


What is the difference between mdf and ndf files?

0 Answers  


Can a composite key be null?

0 Answers  






What is Collation Sensitivity ? What are the various type ?

0 Answers  


What are % type and % rowtype?

0 Answers  


How do I make sql search faster?

0 Answers  


what is d diff between grant,commit,rollback n savepoint

1 Answers  


what are different types of keys in sql?

0 Answers  


What are the blocks in stored procedure?

6 Answers   Microsoft,


1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...

0 Answers   Satyam,


Categories