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
Is sql low level language?
How to fetch alternate records from a table?
What is difference between group by and partition by?
Why stored procedure is faster than query?
How is sql used in oracle?
how many triggers are allowed in mysql table? : Sql dba
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
Can pl sql procedure have a return statement?
What is clause in sql?
How many commands are in sql?
How do I view tables in mysql?
What is the main difference between sql and pl/sql?
What steps server process has to take to execute an update statement?
how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba
What is union, minus and interact commands?