Types of SQL Joins are explained in left, right, and full join and SQL | Join (Cartesian Join & Self Join). And Remaining EQUI Join and NON-EQUI will discuss in this article. Let’s discuss one by one.
- EQUI Join
- NON-EQUI Join
Let’s Consider the two tables given below.
Table name — Student
In this table, you have I’d, name, class and city are the fields.
Select * from Student;
Table name — Record
In this table, you have I’d, class and city are the fields.
Select * from Record;
1. EQUI JOIN :
EQUI JOIN creates a JOIN for equality or matching column(s) values of the relative tables. EQUI JOIN also create JOIN by using JOIN with ON and then providing the names of the columns with their relative tables to check equality using equal sign (=).
SELECT column_list FROM table1, table2.... WHERE table1.column_name = table2.column_name;
SELECT student.name, student.id, record.class, record.city FROM student, record WHERE student.city = record.city;
SELECT column_list FROM table1 JOIN table2 [ON (join_condition)]
SELECT student.name, student.id, record.class, record.city FROM student JOIN record ON student.city = record.city;
2. NON EQUI JOIN :
NON EQUI JOIN performs a JOIN using comparison operator other than equal(=) sign like >, <, >=, <= with conditions.
SELECT * FROM table_name1, table_name2 WHERE table_name1.column [> | < | >= | <= ] table_name2.column;
SELECT student.name, record.id, record.city FROM student, record WHERE Student.id < Record.id ;
- SQL | Join (Cartesian Join & Self Join)
- Difference between Inner Join and Outer Join in SQL
- Difference between Natural join and Inner Join in SQL
- Full join and Inner join in MS SQL Server
- Left join and Right join in MS SQL Server
- Self Join and Cross Join in MS SQL Server
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- Inner Join vs Outer Join
- SQL | Join (Inner, Left, Right and Full Joins)
- SQL Join vs Subquery
- SQL | UPDATE with JOIN
- SQL | Difference between functions and stored procedures in PL/SQL
- Difference between SQL and T-SQL
- Combining aggregate and non-aggregate values in SQL using Joins and Over clause
- SQL | Procedures in PL/SQL
- SQL queries on clustered and non-clustered Indexes
- Difference between Left, Right and Full Outer Join
- Join operation Vs Nested query in DBMS
- SQL | AND and OR operators
- SQL | Functions (Aggregate and Scalar Functions)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.