What is the difference between join and union.

Answer Posted / tanu

UNION: Union Combines results of all select statements,
displaying duplicate rows only one time in the answerset.

Rules for usage:
1. All select clauses must have same number of expressions.
2. Corresponding expressions must have compatible domains.

First SELECT statement:
->Determines output format.
->Determines output title.

Last SELECT statement:
->Contains ORDER BY for the entire result, if required.

EXAMPLE:
SELECT first_name
,last_name
,'employee' (TITLE 'employee//type')
FROM employee
WHERE manager_employee_number = 1019
UNION
SELECT first_name
,last_name
,' manager '
FROM employee
WHERE employee_number = 1019
ORDER BY 2
;

RESULT:

first_name last_name employee_type
Carol Kanieski employee
Ron Kubic manager
John Stein employee

JOIN:
Join is a technique for accessing data from more than one
table in a single answerset. Each row in the answerset may
contain data from columns of more than one table. Tables
are joined on columns sharing common domain.

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is oracle sql free?

556


Explain how exception handling is done in advance pl/sql?

563


What is data manipulation language?

708


what is collation? : Sql dba

626


Is it possible to sort a column using a column alias?

615






What is the command used to fetch the first 5 characters of a string?

717


what is the difference between truncate and drop statements? : Sql dba

563


what is the command line end user interface - mysql? : Sql dba

515


How to run sql statements through the web interface?

522


How to read xml file in oracle pl sql?

521


What is pl sql architecture?

516


How insert into statements in sql?

599


How does an execution block start and end in pl sql?

506


What is java sql drivermanager?

557


How does join work in sql?

562