SlideShare a Scribd company logo
Muhammad Umair
Oracle Database 11g Developer Track
› Cartesian Product
– A Cartesian product is formed when:
› A join condition is invalid
› All row of table A are joined with table B all rows
– To avoid Cartesian product always include a valid join condition in
where clause
› Types Of Joins
› Cross Join
› Natural Join
› Equijoin
› Non-Equijoin
› Self Join
› Inner Join
› Outer Join
› Cross join
– Same as Cartesian product
– SELECT employees.employee_name, departments.department_name
– FROM employees
– Corss Join departments;
› Natural join
– Join all columns in the two tables that have the same name.
– Selects rows from the two tables that have equal values in all matches
columns.
– If the columns having the same names but different datatypes, error
will return
– SELECT employees.employee_name, departments.department_name
– FROM employees
– Natural Join departments;
› Equijoin
– SELECT employees.employee_name, departments.department_name
– FROM employees,departments
– WHERE employees.department_id = departments.department_id;
› Using Operatores in Equijoin
– SELECT employees.employee_name, departments.department_name
– FROM employees,departments
– WHERE employees.department_id = departments.department_id
– AND employee_id = 105;
› More Then Two Tables
– SELECT employees.employee_name,
departments.department_name,city
– FROM employees,departments,locations
– WHERE employees.department_id = departments.department_id
– AND departments.location_id = location.location_id;
;
› Non-Equijoin
– SELECT e.first_name,j.grade_level
– FROM employees e, job_grades j
– WHER e.salary
– BETWEEN j.lowest_sal AND j.highest_sal;
› Self Join
– SELECT w.first_name ||’ works for ’|| e.first_name
– FROM employees w, employees e
– WHER e.manager_id = m.employee_id
› INNER JOIN
– Returns all rows when there is at least one match in BOTH tables
– SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID;
› OUTER JOIN
– You use outer join to see rows that do not meet the join condition.
– LEFT JOIN
› Return all rows from the left table, and the matched rows from the right table
– RIGHT JOIN
› Return all rows from the right table, and the matched rows from the left table
– FULL JOIN
– Return all rows when there is a match in ONE of the tables
Left JOIN
Right JOIN
Full JOIN
› Left JOIN
– SELECT e.last_name, e.department_id, d.department_name
– FROM employees e
– LEFT OUTER JOIN department d
– ON (e.department_id = d.epartment_id);
– SELECT e.last_name, e.department_id, d.department_name
– FROM employees e, departments d
– WHERE e.department_id (+)= d.epartment_id;
› Right JOIN
– SELECT e.last_name, e.department_id, d.department_name
– FROM employees e
– Right OUTER JOIN department d
– ON (e.department_id = d.epartment_id);
– SELECT e.last_name, e.department_id, d.department_name
– FROM employees e, departments d
– WHERE e.department_id = d.epartment_id (+);
› Full Outer JOIN
– SELECT e.last_name, e.department_id, d.department_name
– FROM employees e
– FULL OUTER JOIN department d
– ON (e.department_id = d.epartment_id);

More Related Content

What's hot

Join sql
Join sqlJoin sql
Join sql
Vikas Gupta
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
Sql join
Sql  joinSql  join
Sql join
Vikas Gupta
 
Join query
Join queryJoin query
Join query
Waqar Ali
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
Ritwik Das
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set
Mohd Tousif
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
Vibrant Technologies & Computers
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
Deepthi Rachumallu
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
DataminingTools Inc
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
Umme habiba
 
Oracle sql joins
Oracle sql joinsOracle sql joins
Oracle sql joins
redro
 
Lab4 join - all types listed
Lab4   join - all types listedLab4   join - all types listed
Lab4 join - all types listed
Balqees Al.Mubarak
 
MULTIPLE TABLES
MULTIPLE TABLES MULTIPLE TABLES
MULTIPLE TABLES
ASHABOOPATHY
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
Paul Harkins
 
Displaying data from multiple tables
Displaying data from multiple tablesDisplaying data from multiple tables
Displaying data from multiple tables
Syed Zaid Irshad
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
PuNeEt KuMaR
 
SQL Join's
SQL Join'sSQL Join's

What's hot (20)

Join sql
Join sqlJoin sql
Join sql
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
Sql join
Sql  joinSql  join
Sql join
 
Join query
Join queryJoin query
Join query
 
SQL
SQLSQL
SQL
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
SQL Practice Question set
SQL Practice Question set SQL Practice Question set
SQL Practice Question set
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
 
Oracle sql joins
Oracle sql joinsOracle sql joins
Oracle sql joins
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
Lab4 join - all types listed
Lab4   join - all types listedLab4   join - all types listed
Lab4 join - all types listed
 
MULTIPLE TABLES
MULTIPLE TABLES MULTIPLE TABLES
MULTIPLE TABLES
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Displaying data from multiple tables
Displaying data from multiple tablesDisplaying data from multiple tables
Displaying data from multiple tables
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
SQL Join's
SQL Join'sSQL Join's
SQL Join's
 

Viewers also liked

Database intro
Database introDatabase intro
Database introKara Ross
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
Forrester High School
 
Relational database intro for marketers
Relational database intro for marketersRelational database intro for marketers
Relational database intro for marketers
Steve Finlay
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
Naimul Arif
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBase
DevMix
 
MySQL - Intro to Database
MySQL - Intro to DatabaseMySQL - Intro to Database
MySQL - Intro to Database
Chester Chin
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
Abdul Rahman Sherzad
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationshipswmassie
 
SQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management SystemSQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management System
Tanner Jessel
 
Database presentation
Database presentationDatabase presentation
Database presentationwebhostingguy
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
Mudasir Qazi
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Pongsakorn U-chupala
 

Viewers also liked (16)

Database intro
Database introDatabase intro
Database intro
 
Database intro
Database introDatabase intro
Database intro
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Relational database intro for marketers
Relational database intro for marketersRelational database intro for marketers
Relational database intro for marketers
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
Course intro
Course introCourse intro
Course intro
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBase
 
MySQL - Intro to Database
MySQL - Intro to DatabaseMySQL - Intro to Database
MySQL - Intro to Database
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
SQLite - Overview
SQLite - OverviewSQLite - Overview
SQLite - Overview
 
SQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management SystemSQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management System
 
Database presentation
Database presentationDatabase presentation
Database presentation
 
joins in database
 joins in database joins in database
joins in database
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Similar to Database Joins

Les05 (Displaying Data from Multiple Table)
Les05 (Displaying Data from Multiple Table)Les05 (Displaying Data from Multiple Table)
Les05 (Displaying Data from Multiple Table)
Achmad Solichin
 
App C
App CApp C
e computer notes - From multiple tables
e computer notes - From multiple tablese computer notes - From multiple tables
e computer notes - From multiple tablesecomputernotes
 
Querying_with_T-SQL_-_03 (1).pptx
Querying_with_T-SQL_-_03 (1).pptxQuerying_with_T-SQL_-_03 (1).pptx
Querying_with_T-SQL_-_03 (1).pptx
MAHIN33
 
Querying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptxQuerying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptx
MAHIN33
 
sql language
sql languagesql language
sql language
moman abde
 
Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptx
uzmasulthana3
 
Day4 Join Query _Combining the data.pptx
Day4 Join Query _Combining the data.pptxDay4 Join Query _Combining the data.pptx
Day4 Join Query _Combining the data.pptx
deeppooja3
 
Oracle SQL DML Statements
Oracle SQL DML StatementsOracle SQL DML Statements
Oracle SQL DML Statements
A Data Guru
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdf
HasankaWijesinghe1
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
anish kumar
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
TechandMate
 
e computer notes - Advanced subqueries
e computer notes - Advanced subqueriese computer notes - Advanced subqueries
e computer notes - Advanced subqueriesecomputernotes
 
Excel tutorial
Excel tutorialExcel tutorial
Excel tutorial
SayeedAsghar
 
Module 3.1.pptx
Module 3.1.pptxModule 3.1.pptx
Module 3.1.pptx
ANSHVAJPAI
 

Similar to Database Joins (20)

Les05 (Displaying Data from Multiple Table)
Les05 (Displaying Data from Multiple Table)Les05 (Displaying Data from Multiple Table)
Les05 (Displaying Data from Multiple Table)
 
App C
App CApp C
App C
 
e computer notes - From multiple tables
e computer notes - From multiple tablese computer notes - From multiple tables
e computer notes - From multiple tables
 
Querying_with_T-SQL_-_03 (1).pptx
Querying_with_T-SQL_-_03 (1).pptxQuerying_with_T-SQL_-_03 (1).pptx
Querying_with_T-SQL_-_03 (1).pptx
 
Querying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptxQuerying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptx
 
sql language
sql languagesql language
sql language
 
Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptx
 
Les06
Les06Les06
Les06
 
Day4 Join Query _Combining the data.pptx
Day4 Join Query _Combining the data.pptxDay4 Join Query _Combining the data.pptx
Day4 Join Query _Combining the data.pptx
 
Oracle SQL DML Statements
Oracle SQL DML StatementsOracle SQL DML Statements
Oracle SQL DML Statements
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdf
 
0808.pdf
0808.pdf0808.pdf
0808.pdf
 
0808.pdf
0808.pdf0808.pdf
0808.pdf
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
Joins SQL Server
Joins SQL ServerJoins SQL Server
Joins SQL Server
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
 
e computer notes - Advanced subqueries
e computer notes - Advanced subqueriese computer notes - Advanced subqueries
e computer notes - Advanced subqueries
 
Excel tutorial
Excel tutorialExcel tutorial
Excel tutorial
 
Module03
Module03Module03
Module03
 
Module 3.1.pptx
Module 3.1.pptxModule 3.1.pptx
Module 3.1.pptx
 

More from Umair Shakir

Basic SQL Statments
Basic SQL StatmentsBasic SQL Statments
Basic SQL Statments
Umair Shakir
 
Introduction to Sql
Introduction to SqlIntroduction to Sql
Introduction to Sql
Umair Shakir
 
Services of dbms
Services of dbmsServices of dbms
Services of dbms
Umair Shakir
 
Constraints
ConstraintsConstraints
Constraints
Umair Shakir
 
Task of db administrator
Task of db administratorTask of db administrator
Task of db administrator
Umair Shakir
 
Schema Objects
Schema ObjectsSchema Objects
Schema Objects
Umair Shakir
 
Relationships
RelationshipsRelationships
Relationships
Umair Shakir
 
Relational model
Relational modelRelational model
Relational model
Umair Shakir
 
Normalization
NormalizationNormalization
Normalization
Umair Shakir
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
Umair Shakir
 
Er model
Er modelEr model
Er model
Umair Shakir
 
Introduction to basic database concepts
Introduction to basic database conceptsIntroduction to basic database concepts
Introduction to basic database concepts
Umair Shakir
 
Dbms and rdbms
Dbms and rdbmsDbms and rdbms
Dbms and rdbms
Umair Shakir
 
Database planning
Database planningDatabase planning
Database planning
Umair Shakir
 
Conceptual database design
Conceptual database designConceptual database design
Conceptual database design
Umair Shakir
 
Work Sheet
Work SheetWork Sheet
Work Sheet
Umair Shakir
 

More from Umair Shakir (17)

Basic SQL Statments
Basic SQL StatmentsBasic SQL Statments
Basic SQL Statments
 
Introduction to Sql
Introduction to SqlIntroduction to Sql
Introduction to Sql
 
Services of dbms
Services of dbmsServices of dbms
Services of dbms
 
Constraints
ConstraintsConstraints
Constraints
 
Task of db administrator
Task of db administratorTask of db administrator
Task of db administrator
 
Schema Objects
Schema ObjectsSchema Objects
Schema Objects
 
Relationships
RelationshipsRelationships
Relationships
 
Relational model
Relational modelRelational model
Relational model
 
Normalization
NormalizationNormalization
Normalization
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
 
Er model
Er modelEr model
Er model
 
Introduction to basic database concepts
Introduction to basic database conceptsIntroduction to basic database concepts
Introduction to basic database concepts
 
Dbms and rdbms
Dbms and rdbmsDbms and rdbms
Dbms and rdbms
 
Database planning
Database planningDatabase planning
Database planning
 
Conceptual database design
Conceptual database designConceptual database design
Conceptual database design
 
Work Sheet
Work SheetWork Sheet
Work Sheet
 
G to a
G to aG to a
G to a
 

Recently uploaded

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 

Recently uploaded (20)

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 

Database Joins

  • 1. Muhammad Umair Oracle Database 11g Developer Track
  • 2. › Cartesian Product – A Cartesian product is formed when: › A join condition is invalid › All row of table A are joined with table B all rows – To avoid Cartesian product always include a valid join condition in where clause
  • 3. › Types Of Joins › Cross Join › Natural Join › Equijoin › Non-Equijoin › Self Join › Inner Join › Outer Join
  • 4. › Cross join – Same as Cartesian product – SELECT employees.employee_name, departments.department_name – FROM employees – Corss Join departments;
  • 5. › Natural join – Join all columns in the two tables that have the same name. – Selects rows from the two tables that have equal values in all matches columns. – If the columns having the same names but different datatypes, error will return – SELECT employees.employee_name, departments.department_name – FROM employees – Natural Join departments;
  • 6. › Equijoin – SELECT employees.employee_name, departments.department_name – FROM employees,departments – WHERE employees.department_id = departments.department_id;
  • 7. › Using Operatores in Equijoin – SELECT employees.employee_name, departments.department_name – FROM employees,departments – WHERE employees.department_id = departments.department_id – AND employee_id = 105;
  • 8. › More Then Two Tables – SELECT employees.employee_name, departments.department_name,city – FROM employees,departments,locations – WHERE employees.department_id = departments.department_id – AND departments.location_id = location.location_id; ;
  • 9. › Non-Equijoin – SELECT e.first_name,j.grade_level – FROM employees e, job_grades j – WHER e.salary – BETWEEN j.lowest_sal AND j.highest_sal;
  • 10. › Self Join – SELECT w.first_name ||’ works for ’|| e.first_name – FROM employees w, employees e – WHER e.manager_id = m.employee_id
  • 11. › INNER JOIN – Returns all rows when there is at least one match in BOTH tables – SELECT Customers.CustomerName, Orders.OrderID FROM Customers INNER JOIN Orders ON Customers.CustomerID=Orders.CustomerID;
  • 12. › OUTER JOIN – You use outer join to see rows that do not meet the join condition. – LEFT JOIN › Return all rows from the left table, and the matched rows from the right table – RIGHT JOIN › Return all rows from the right table, and the matched rows from the left table – FULL JOIN – Return all rows when there is a match in ONE of the tables
  • 14. › Left JOIN – SELECT e.last_name, e.department_id, d.department_name – FROM employees e – LEFT OUTER JOIN department d – ON (e.department_id = d.epartment_id); – SELECT e.last_name, e.department_id, d.department_name – FROM employees e, departments d – WHERE e.department_id (+)= d.epartment_id;
  • 15. › Right JOIN – SELECT e.last_name, e.department_id, d.department_name – FROM employees e – Right OUTER JOIN department d – ON (e.department_id = d.epartment_id); – SELECT e.last_name, e.department_id, d.department_name – FROM employees e, departments d – WHERE e.department_id = d.epartment_id (+);
  • 16. › Full Outer JOIN – SELECT e.last_name, e.department_id, d.department_name – FROM employees e – FULL OUTER JOIN department d – ON (e.department_id = d.epartment_id);