mysql  self join  keyword

the self join clause that you can join a table to itself.

you use self join when you want to combine records with other records in the same table.

below is selection from the "user" table:

useridfirstnamelastnamemobilenocity
1sandeepkumar9549293245india
2ramkumar9549293212usa
3shyamdhaka2323234545jaipur
4ankitnehra3423567845uae
5radhakumari2323121212jaipur

and selection from the "company" table:

productidcompanynametype
1facebooksocial website
2gmailmailing service
3googlesearch engine

mysql  self join  example

                select   user.userid, firstname, companyname
                
                from     user , 
                
                right join   company    
                
                on       user.userid = company.productid;