SlideShare a Scribd company logo
1 of 16
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

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
 
Relational database intro for marketers
Relational database intro for marketersRelational database intro for marketers
Relational database intro for marketersSteve Finlay
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBaseDevMix
 
MySQL - Intro to Database
MySQL - Intro to DatabaseMySQL - Intro to Database
MySQL - Intro to DatabaseChester Chin
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsAbdul 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 SystemTanner Jessel
 
Database presentation
Database presentationDatabase presentation
Database presentationwebhostingguy
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 

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 Oracle Database 11g Developer Track 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
 
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.pptx
Querying_with_T-SQL_-_03.pptxQuerying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptxMAHIN33
 
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).pptxMAHIN33
 
Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxuzmasulthana3
 
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.pptxdeeppooja3
 
Oracle SQL DML Statements
Oracle SQL DML StatementsOracle SQL DML Statements
Oracle SQL DML StatementsA Data Guru
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfHasankaWijesinghe1
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Languageanish 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
 
Module 3.1.pptx
Module 3.1.pptxModule 3.1.pptx
Module 3.1.pptxANSHVAJPAI
 

Similar to Oracle Database 11g Developer Track 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.pptx
Querying_with_T-SQL_-_03.pptxQuerying_with_T-SQL_-_03.pptx
Querying_with_T-SQL_-_03.pptx
 
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
 
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

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

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 

Recently uploaded (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 

Oracle Database 11g Developer Track 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);