Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via Email

MySQL Joins

MySQL Joins

MySQL Joins is used to get results from two or more tables and combine them in a single result sets most common type of join is inner join.


Syntax of INNER JOIN

SELECT columnList from table1 [INNER] JOIN table2 ON 
joinCondition1 [INNER] JOIN table3 ON joinCondition2....

Example of INNER JOIN

SELECT student_name, physics_marks FROM student_info 
INNER JOIN student_marks ON student_info.student_name = 
student_marks.name

Code Explanation

  • In this example we combine two tables studen_info and student_marks using inner join.

  • In this we get student_name from studen_info table and physics_marks from student_marks table.

  • In this we get every row if student_name from studen_info is equal to name from student_name.

  • You must use tableName.columnName syntax in writting the conditions.


Join Tables from another Database

Syntax


SELECT columnList from table1 [INNER] JOIN databasename.table2
ON joinCondition1 [INNER] JOIN table3 ON joinCondition2....
PrevNext

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH

Check Out SEMRUSH