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
How to combine two stored procedures in sql?
Can we perform dml in function?
Can we create index on primary key?
What is rollback?
Explain what is a subquery ?
Sql technical questions
How many types of tables are there?
State few characteristics of pl/sql?
How to place comments in pl/sql?
What is the difference between mdf and ndf files?
what is online transaction processing (oltp)? : Sql dba
What is the difference between sql and t sql?
What is a string data type in sql?
how to add a new column to an existing table in mysql? : Sql dba
How can you tell the difference between an index and a view?