Back to articles
Introduction to Joins and Windows Funtions in SQL
How-ToSystems

Introduction to Joins and Windows Funtions in SQL

via Dev.toOnyango Victor ochieng

Introduction Joins define relational operations that primarily combine data from multiple tables based on a logical relationship which in most cases is a foreign key, potentially increasing row counts and expanding columns. When working with databases, specifically normalized databases, it is a best practice to distribute data across multiple tables subsequently enforcing integrity and eliminating redundancy. The different types of joints include the INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, and CROSS JOIN. INNER JOIN This is the default join type that returns only matching records from the referenced tables in the query. Example SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID; LEFT JOIN Returns all rows from the left table (the first table) and matched rows from the right (second table), with NULLs for unmatched right-side rows. Example SELECT Customers.CustomerName, Orders.OrderID FRO

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles