JOIN
JOIN is used to display data from more than two tables.
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE1 T1 JOIN TABLE2 T2 ON
(T1.JOB_ID=T2.JOB_ID);
NOTES: To join n tables together, we need a minimum of n-1 join conditions.
UNION
UNION is used to display combined data from two tables into a single result set.
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE1
UNION
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE2
NOTES: The number of columns and order must match in all tables.
JOIN is used to display data from more than two tables.
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE1 T1 JOIN TABLE2 T2 ON
(T1.JOB_ID=T2.JOB_ID);
NOTES: To join n tables together, we need a minimum of n-1 join conditions.
UNION
UNION is used to display combined data from two tables into a single result set.
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE1
UNION
SELECT FIRST_NAME ,LAST_NAME,JOB_ID FROM TABLE2
NOTES: The number of columns and order must match in all tables.
No comments:
Post a Comment