If you just want to get ( SELECT ), the desired output and TableA may contain records that are not in TableB , then you can emulate FULL JOIN to achieve your goal
SELECT e.eng, COALESCE(a.hindi, b.hindi) hindi FROM ( SELECT eng FROM TableB UNION SELECT eng FROM TableA ) e LEFT JOIN TableB b ON e.eng = b.eng LEFT JOIN TableA a ON e.eng = a.eng
If, on the other hand, TableA always contains only a subset of eng values ββof TableB , then you can simply use LEFT JOIN
SELECT b.eng, COALESCE(a.hindi, b.hindi) hindi FROM TableB b LEFT JOIN TableA a ON b.eng = a.eng
Here is the SQLFiddle demo
Now, if you want to update the contents of TableA and assuming A_id is AUTOINCREMENT , you can do
INSERT INTO TableA (eng, hindi) SELECT b.eng, b.hindi FROM TableB b LEFT JOIN TableA a ON b.eng = a.eng WHERE a.eng IS NULL
Here is the SQLFiddle demo
or
INSERT INTO TableA (eng, hindi) SELECT b.eng, b.hindi FROM TableB b WHERE NOT EXISTS ( SELECT * FROM TableA WHERE eng = b.eng );
Here is the SQLFiddle demo
peterm
source share