The union operator brings back all rows that are the same in the tables
The union all operator brings back only the rows that aren't the same.
select bid, name, tid
from boys
where name like 'B%'
union
select bid, name, tid
from boys
where name like 'J%'
select bid, name, tid
from boys
where name like 'B%'
union all
select bid, name, tid
from boys
where name like 'J%'
self join
select name, el.name
from employees e
inner join employees e1
on e.mid = e1.empid
No comments:
Post a Comment