So here I have 2 tables and I need help understanding the basics of joins. I have developed some pieces of SQL code, but im not sure what they will output. I need to know what each one will output. INNER JOIN - SELECT StudentDetails.NAME, StudentMarks.MARKS FROM StudentDetails INNER JOIN StudentMarks ON StudentDetails.S_ID = StudentMarks.ID; LEFT JOIN - SELECT Name, Address, Age FROM StudentDetails LEFT JOIN StudentMarks ON S_ID=ID; RIGHT JOIN - SELECT Name, Address, Age FROM StudentDetails RIGHT JOIN StudentMarks ON S_ID=ID; FULL JOIN - SELECT StudentDetails.NAME, StudentMarks.MARKS FROM StudentDetails FULL OUTER JOIN StudentMarks ON StudentDetails.S_ID = StudentMarks.ID;
So here I have 2 tables and I need help understanding the basics of joins. I have developed some pieces of SQL code, but im not sure what they will output. I need to know what each one will output.
INNER JOIN - SELECT StudentDetails.NAME, StudentMarks.MARKS FROM StudentDetails INNER JOIN StudentMarks ON StudentDetails.S_ID = StudentMarks.ID;
LEFT JOIN - SELECT Name, Address, Age FROM StudentDetails LEFT JOIN StudentMarks ON S_ID=ID;
RIGHT JOIN - SELECT Name, Address, Age FROM StudentDetails RIGHT JOIN StudentMarks ON S_ID=ID;
FULL JOIN - SELECT StudentDetails.NAME, StudentMarks.MARKS FROM StudentDetails FULL OUTER JOIN StudentMarks ON StudentDetails.S_ID = StudentMarks.ID;
Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 10 images