MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

MySQL

Inner Join in MySQL
Previous Home Next

It is almost similar to join query syntax and gives the similar output as join gives, just replace JOIN as INNER JOIN.

Syntax for inner join

SELECT columnname1, columnname2
FROM tablename1
INNER JOIN tablename2 ON common condition1
INNER JOIN tablename3 ON common condition2

Example

SELECT *
FROM studadr 
INNER JOIN studinfo 
ON studinfo.sid = studadr.sid ;

The table define after from clause is the first output followed by second table output in single output, here we have define 'studadr' followed by 'studinfo'.

Example

 

SELECT *
FROM studinfo 
INNER JOIN studadr 
ON studinfo.sid = studadr.sid ;

The above code gives the reverse result as the table order define in the clause.

Example

SELECT fname,age,lname,street
FROM studinfo
INNER JOIN studadr 
ON studinfo.sid = studadr.sid ;

In the above code we can reverse the table name order but the result will remain same, we can change the output order like street , age n anything to get the desired order result.

Example

SELECT fname,age,lname,street
FROM studinfo
INNER JOIN studadr 
ON studinfo.sid = studadr.sid 
WHERE studinfo.sid > 105
order by fname ;

In the above code we have can use either WHERE clause or ORDER BY clause , but here can use both to get the desired output on the specified condition.

Example

SELECT *
FROM studadr
INNER JOIN studinfo ON studinfo.sid = studadr.sid
Inner join studptin ON studadr.said=studptin.said ;

Output:

This gives the combination of all the three tables define in the above code, to get the shorter and select result check the next code.

Example

SELECT Name, Fname, Street
FROM studadr
INNER JOIN studinfo ON studinfo.sid = studadr.sid
Inner join studptin ON studadr.said = studptin.said;

In the above code we get the selected output like Name from STUDPTIN Table , Fname From STUDINFO Table and street From STUDADR Table and the comman table that contain the join of both the table is STUDADR is use in from condition.

Previous Home Next