Q:

Mysql select from two tables,get all datas,make num 0 if not exist

table a:
name
a
e

table b:
name   num
   a    10
   b    20
   c    30

i want to get :
name    num
a   10
b   20
c   30
e   0

My sql sentence is ：
select c.name,
IFNULL (b.num,0) as 'num'
from
(select name from a
union 
select name from b) c
left join b
on c.`name`=b.`name`

is there other way to get this result more simple？

A:

FULL OUTER JOIN can be achieve by below in mysql 

SELECT a.name, IFNULL (b.num,0) as 'num' FROM a
LEFT OUTER JOIN b ON b.name = a.name
UNION
SELECT b.name, IFNULL (b.num,0) as 'num' FROM a
RIGHT OUTER JOIN b ON a.name = b.name

