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 grant a ddl statement?
what is the difference between clustered and non clustered index in sql? : Sql dba
What are different clauses used in sql?
What is the difference between in and between in sql?
Explain the difference in execution of triggers and stored procedures?
What does varchar include?
What is sqlite format?
How can you fetch common records from two tables?
What is scope of pl sql developer in future?
Can we alter stored procedure?
What are commit, rollback, and savepoint?
Which function is used to return remainder in a division operator in sql?
define sql insert statement ? : Sql dba
What is the command used to fetch first 5 characters of the string?
List the various privileges that a user can grant to another user?