SQL JOINAs the name shows, JOIN means to combine something. In case of SQL, JOIN means "to combine two or more tables". In SQL, JOIN clause is used to combine the records from two or more tables in a database. Types of SQL JOIN
Sample TableEMPLOYEE
PROJECT
1. INNER JOINIn SQL, INNER JOIN selects records that have matching values in both tables as long as the condition is satisfied. It returns the combination of all rows from both the tables where the condition satisfies. Syntax Query Output
2. LEFT JOINThe SQL left join returns all the values from left table and the matching values from the right table. If there is no matching join value, it will return NULL. Syntax Query Output
3. RIGHT JOINIn SQL, RIGHT JOIN returns all the values from the values from the rows of right table and the matched values from the left table. If there is no matching in both tables, it will return NULL. Syntax Query Output
4. FULL JOINIn SQL, FULL JOIN is the result of a combination of both left and right outer join. Join tables have all the records from both tables. It puts NULL on the place of matches not found. Syntax Query Output
Next TopicDBMS SQL Set Operation
|