Posts

Showing posts with the label (Left / Right / Inner )Join

12 - Combining Two Tables- JOIN ( Inner , Left and Right)

Image
  What is join in SQL database? SQL JOIN is a clause that is used to combine multiple tables and retrieve data based on a common field in relational databases TABLES WITH NAME employees AND department_location WITH ONE COMMON COLUMN NAME department employees department_location INNER JOIN The INNER JOIN keyword selects records that have matching values in both tables. select e.first_name,e.salary,d.department,d.location from employees e inner join department_location d on e.department=d.department; LEFT JOIN The LEFT JOIN keyword returns all records from the left table  (table1), and the matching records from the right table (table2).  The result is 0 records from the right side, if there is no match select e.first_name,e.salary,d.department,d.location from employees e left join department_location d on e.department=d.department; RIGHT JOIN The RIGHT JOIN keyword returns all records from the right table (table2), and the matching records from the left table (ta...