Sql Joins Notes Pdf //top\\ Official

SQL Joins Notes PDF Reading Time: 15 Minutes Difficulty Level: Beginner to Intermediate

SELECT * FROM students RIGHT JOIN courses ON students.id = courses.student_id; sql joins notes pdf

| Join Type | Returns | |-------------------------|-----------------------------------------------| | INNER JOIN | Rows with match in both tables | | LEFT JOIN | All left rows + matched right rows | | RIGHT JOIN | All right rows + matched left rows | | FULL OUTER JOIN | All rows from both tables | | CROSS JOIN | Cartesian product | | SELF JOIN | Table joined to itself (use aliases) | | NATURAL JOIN (rare) | Automatically joins on same column names | SQL Joins Notes PDF Reading Time: 15 Minutes

SELECT e1.name AS Employee, e2.name AS Manager FROM employees e1 LEFT JOIN employees e2 ON e1.manager_id = e2.employee_id; sql joins notes pdf

The most common join. It returns only the rows where there is a match in tables.

Scroll to Top