It returns a result set by making the cartesian product of both the tables,and where clause to get the restricted result set according to the condition.
SELECT * FROM employee e, dept d WHERE e.id_dept=d.id_dept ;
use of USING keyword When USING keyword is used,then the column name specified must present in both the tables.
SELECT a.*,b.ele FROM test1 a JOIN test2 b USING (par_id) WHERE par_id<>4;
SELECT a.*,b.ele FROM test1 a JOIN test2 b ON a.par_id=b. par_id ;
It returns all the record from left table of join and matching records from the right table according to the join condition.
SELECT a.*,b.ele FROM test1 a LEFT JOIN test2 b ON a.id=b. par_id WHERE b.id IS NOT NULL;
SELECT a.*,b.ele FROM test1 a LEFT JOIN test2 b USING( par_id) WHERE b.id IS NOT NULL;
It returns all the record from right table of join and matching records from the left table according to the join condition.
SELECT a.*,b.ele FROM test1 a RIGHT JOIN test2 b ON a.id=b. par_id WHERE a.id IS NOT NULL;
SELECT a.*,b.ele FROM test1 a RIGHT JOIN test2 b USING( par_id) WHERE a.id IS NOT NULL;
It returns the result set from both the tables according to the condition.
SELECT a.*,b.ele FROM test1 a INNER JOIN test2 b ON a.id=b. par_id WHERE a.id IS NOT NULL;
DELETE t3,t4 FROM test3 t3 INNER JOIN test4 t4 ON t3.par_id=t4.id;
UPDATE test3 AS t3 INNER JOIN test4 AS t4 ON t3.par_id=t4.id SET t3.name = 'AFIXI TECHNOLOGY', t4.address = 'NEW M1 IT ZONE,PATIA';