three types of outer join
full outer join (not supported in mysql or msaccess)
left outer join
right outer join
outer join returns
not only rows matching join condition, but also rows with unmatched values
outer join basically provides an inner join plus
additional rows, with partial info, where join condition wasn’t true
you have two tables. table A has emp_id 201, 202, and 203 with fname and lname. table B has emp_id 202, 203, and 204 with salary.
what is the output if you use left outer join?
201 emp_id, fname, lname, blank emp_id and salary
202 emp_id, fname, lname, emp_id, salary
203 emp_id, fname, lname, emp_id, salary
you have two tables. table A has emp_id 201, 202, and 203 with fname and lname. table B has emp_id 202, 203, and 204 with salary.
what is the output if you use right outer join?
202 fname, lname, emp_id, salary
203 fname, lname, emp_id, salary
null, null, null, emp_id (204), salary
if statement
allows for displaying results that satisfy conflicting conditions at the same time
if syntax
select if (condition1, result1, result2) from…
condition1 = logical conditional (T/F)
result1 = value if true
result2 = value if false
union of two sql statements
combines the output of 2 select statements
- supports combining databases
- supports representing multiple competing conditions simultaneously
union of 2 sql statements requires
same number of attributes in each statement, and corresponding data types to be compatible
t/f: union of 2 sql statements does not remove duplicates
false. it does.
union syntax
select…from…where
UNION
select…from…where