Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
764 views
in Computer by (25.1k points)

What is the use of JOIN command?

1 Answer

+1 vote
by (26.0k points)
selected by
 
Best answer

SQL joins are used to combine rows from two or more tables.
There are 4 different types of SQL joins:

  • SQL INNER JOIN (or sometimes called simple join)
  • SQL LEFT JOIN
  • SQL RIGHT JOIN
  • SQL FULL JOIN

1. SQL INNER JOIN (simple join)

SQL INNER JOINS return all rows from multiple tables where the join condition is met.
Syntax:
> SELECT columns FROM table1 INNER JOIN table2 ON table1.column = table2.column;
In this visual diagram, the SQL INNER JOIN returns the shaded area:

The SQL INNER JOIN would return the records where table1 and table2 intersect.

2. SQL LEFT JOIN:
This type of join returns all rows from the LEFT-hand table specified in the ON condition and only those rows from the other table where the joined fields are equal (join condition is met).
Syntax:
> SELECT columns FROM table1 LEFT JOIN table2 ON table1.column = table2.column;
In this visual diagram, the SQL LEFT JOIN returns the shaded area:

The SQL LEFT JOIN would return the all records from table1 and only those records from table2 that intersect with table1.

3. SQL RIGHT JOIN:
This type of join returns all rows from the RIGHT-hand table specified in the ON condition and only those rows from the other table where the joined fields are equal (join condition is met).
Syntax:
> SELECT columns FROM table1 RIGHT JOIN table2 ON table1.column = table2.column;
In this visual diagram, the SQL RIGHT JOIN returns the shaded area:

The SQL RIGHT JOIN would return the all records from table2 and only those records from table1 that intersect with table2.

4. SQL FULL JOIN:
This type of join returns all rows from the LEFT-hand table and RIGHT-hand table with nulls in place where the join condition is not met.
Syntax:
> SELECT columns FROM table1 FULL JOIN table2 ON table1.column = table2.column;
In this visual diagram, the SQL FULL JOIN returns the shaded area:

The SQL FULL JOIN would return the all records from both table1 and table2.

Related questions

0 votes
1 answer
asked Mar 31, 2020 in Computer by Punit01 (25.1k points)
0 votes
1 answer
asked Mar 31, 2020 in Computer by Punit01 (25.1k points)
0 votes
1 answer
asked Mar 31, 2020 in Computer by Punit01 (25.1k points)
0 votes
1 answer
0 votes
1 answer
asked Mar 31, 2020 in Computer by Punit01 (25.1k points)

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...