MySQL INNER/ SIMPLE JOIN

MySQL INNER/ SIMPLE JOIN

INNER JOIN returns rows from both tables that satisfy with given conditions.

Syntax

SELECT column_list

FROM table_1

INNER JOIN table_2 ON join_condition;

Example

SELECT r.rollno, r.name, f.fees, f.status

FROM register r

INNER JOIN fees f ON r.rollno = f.id;

If both tables use the same column to match, you can use the USING clause also

Syntax

SELECT column_list
FROM table_1
INNER JOIN table_2 USING (column_name);

Example

SELECT r.rollno,r.name,f.fees,f.status

FROM register r

INNER JOIN fees f USING (rollno);

Or

SELECT rollno,name,fees,status

FROM register

INNER JOIN fees USING (rollno);

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*