SlideShare a Scribd company logo
CROSS JOIN APPLICATIONS
Abdul Rahman Sherzad
Computer Science Lecturer
Herat University, Afghanistan
Definition
■ Cross joins are used to return
every combination of rows from
two and more than two tables.
■ Cross Joins are sometimes
called a Cartesian product.
2
Example 1: Product
and Size
■ Suppose you want every
combination of product table
and size table, as illustrated
below:
3
Example 2: Product
and Color
■ Suppose you want every
combination of product/item
table and color table, as
illustrated below:
4
Example 3:
Product, Size and
Color
■ Suppose you want every
combination of product table,
size table, and color table, as
illustrated below:
5
Example 4: Student and Subject
■ Suppose you want to print every combination of Student table and
Subject table to record their marks, as illustrated below:
6
Example 5: Scenario
■ Calculating students’ attendance in comparison to the subjects’
requirement:
– Let’s consider an example where the faculty would like to know students’
attendance against the subjects’ requirements. Also, let’s suppose some
subjects are offered by several faculties, even different universities. Hence
students can attend those subjects at different locations.
■ In such a scenario, the cross join is required to identify those students which did not
attended some of the subjects at all. Then a left outer join is required to be used as
a final step.
7
Example 5: Inputs
Subjects Attendance
Requirement
Students Attendance
Records
8
Example 5: Cross Join
Subjects Attendance Requirement CROSS JOIN Students Attendance
Records
The cross join successfully
identified subject “Math” where
student “20003” did not attend it
at all.
9
Example 5: Left Outer Join
Left Outer Join of the Cross-Join output with Students Attendance
Records total as the final step.
10
Example 6 – Deck of Cards
■ This is another interesting example of Cross Join demonstrating the true application
of Cartesian Product
– This example may not be very practical but very useful in teaching
■ Standard Deck of Cards
– The standard playing card ranks {Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen,
King} form a 13-element set.
– The card suits {space ♠, heart ♥, diamond ♦, club ♣} form a four-element
set.
– The Cross Join (Cartesian product) of these sets returns a 52-element set
consisting of 52 ordered pairs, which correspond to all 52 possible playing
cards.
11
Example 6 – Inputs
Card suits Playing card ranks
12
EXAMPLE 6
–
OUTPUT
13
14
If you do not challenge yourself,
you will never realize what you
can become.

More Related Content

What's hot

Object oriented databases
Object oriented databasesObject oriented databases
Object oriented databases
Sajith Ekanayaka
 
Introduction to data link layer
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
swarna sudha
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
Knoldus Inc.
 
Triggers in SQL | Edureka
Triggers in SQL | EdurekaTriggers in SQL | Edureka
Triggers in SQL | Edureka
Edureka!
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
Vikash Sharma
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
Naimul Arif
 
Dbms lifecycle. ..Database System Development Lifecycle
Dbms lifecycle. ..Database System  Development LifecycleDbms lifecycle. ..Database System  Development Lifecycle
Dbms lifecycle. ..Database System Development Lifecycle
Nimrakhan89
 
Grid based method & model based clustering method
Grid based method & model based clustering methodGrid based method & model based clustering method
Grid based method & model based clustering method
rajshreemuthiah
 
Temporal database
Temporal databaseTemporal database
Temporal database
District Administration
 
Data mining tasks
Data mining tasksData mining tasks
Data mining tasks
Khwaja Aamer
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
mohamed khalaf alla mohamedain
 
Data independence
Data independenceData independence
Data independence
Aashima Wadhwa
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
rehaniltifat
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)
pushpalathakrishnan
 
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
Cohesion and coupling
Cohesion and couplingCohesion and coupling
Cohesion and coupling
Aprajita (Abbey) Singh
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Oum Saokosal
 
Hadoop MapReduce Fundamentals
Hadoop MapReduce FundamentalsHadoop MapReduce Fundamentals
Hadoop MapReduce Fundamentals
Lynn Langit
 
SQL Functions
SQL FunctionsSQL Functions
SQL Functions
ammarbrohi
 
Ch5a
Ch5aCh5a

What's hot (20)

Object oriented databases
Object oriented databasesObject oriented databases
Object oriented databases
 
Introduction to data link layer
Introduction to data link layerIntroduction to data link layer
Introduction to data link layer
 
Machine Learning With Logistic Regression
Machine Learning  With Logistic RegressionMachine Learning  With Logistic Regression
Machine Learning With Logistic Regression
 
Triggers in SQL | Edureka
Triggers in SQL | EdurekaTriggers in SQL | Edureka
Triggers in SQL | Edureka
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
Dbms lifecycle. ..Database System Development Lifecycle
Dbms lifecycle. ..Database System  Development LifecycleDbms lifecycle. ..Database System  Development Lifecycle
Dbms lifecycle. ..Database System Development Lifecycle
 
Grid based method & model based clustering method
Grid based method & model based clustering methodGrid based method & model based clustering method
Grid based method & model based clustering method
 
Temporal database
Temporal databaseTemporal database
Temporal database
 
Data mining tasks
Data mining tasksData mining tasks
Data mining tasks
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Data independence
Data independenceData independence
Data independence
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)
 
Relational model
Relational modelRelational model
Relational model
 
Cohesion and coupling
Cohesion and couplingCohesion and coupling
Cohesion and coupling
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Hadoop MapReduce Fundamentals
Hadoop MapReduce FundamentalsHadoop MapReduce Fundamentals
Hadoop MapReduce Fundamentals
 
SQL Functions
SQL FunctionsSQL Functions
SQL Functions
 
Ch5a
Ch5aCh5a
Ch5a
 

Similar to Cross Join Example and Applications

Introductory maths analysis chapter 08 official
Introductory maths analysis   chapter 08 officialIntroductory maths analysis   chapter 08 official
Introductory maths analysis chapter 08 official
Evert Sandye Taasiringan
 
Chapter 8 - Introduction to Probability and Statistics
Chapter 8 - Introduction to Probability and StatisticsChapter 8 - Introduction to Probability and Statistics
Chapter 8 - Introduction to Probability and Statistics
Muhammad Bilal Khairuddin
 
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
Cleophas Rwemera
 
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
KayathryVeerapandian
 
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docxISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
vrickens
 
Unit 8 Fifth Grade cs 2012 2013
Unit 8 Fifth Grade cs 2012 2013Unit 8 Fifth Grade cs 2012 2013
Unit 8 Fifth Grade cs 2012 2013
Isaac_Schools_5
 
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
LoisReinCura
 
Quantitative techniques
Quantitative techniquesQuantitative techniques
Quantitative techniques
smumbahelp
 
Rt graphical representation
Rt graphical representationRt graphical representation
Rt graphical representation
Rinchen
 
Project3
Project3Project3
Project3
ARVIND SARDAR
 
Contribution of mathematician1.pptx
Contribution of mathematician1.pptxContribution of mathematician1.pptx
Contribution of mathematician1.pptx
SagarsinghPatra
 
mathlab-lotty.pptx
mathlab-lotty.pptxmathlab-lotty.pptx
mathlab-lotty.pptx
JENNYPENDICA1
 
G12 graders - Graphing Distributions (Quantitative).pptx
G12 graders - Graphing Distributions (Quantitative).pptxG12 graders - Graphing Distributions (Quantitative).pptx
G12 graders - Graphing Distributions (Quantitative).pptx
Sarah Samy
 
A String Sculpture Illustrating Fermat's Little Theorem
A String Sculpture Illustrating Fermat's Little TheoremA String Sculpture Illustrating Fermat's Little Theorem
A String Sculpture Illustrating Fermat's Little Theorem
James Smith
 
Unit 9 Fifth Grade cs 2012 2013
Unit 9 Fifth Grade cs 2012 2013Unit 9 Fifth Grade cs 2012 2013
Unit 9 Fifth Grade cs 2012 2013
Isaac_Schools_5
 
(8) Lesson 7.5 - Similar Triangles and Indirect measurement
(8) Lesson 7.5 - Similar Triangles and Indirect measurement(8) Lesson 7.5 - Similar Triangles and Indirect measurement
(8) Lesson 7.5 - Similar Triangles and Indirect measurement
wzuri
 
(8) Lesson 9.4
(8) Lesson 9.4(8) Lesson 9.4
(8) Lesson 9.4
wzuri
 
Math-Stage-8-Scheme-of-Work.docx
Math-Stage-8-Scheme-of-Work.docxMath-Stage-8-Scheme-of-Work.docx
Math-Stage-8-Scheme-of-Work.docx
jayashreekrishna5
 
Differentiated instruction
Differentiated instructionDifferentiated instruction
Differentiated instruction
Nicole Muth
 
(8) Lesson 9.2
(8) Lesson 9.2(8) Lesson 9.2
(8) Lesson 9.2
wzuri
 

Similar to Cross Join Example and Applications (20)

Introductory maths analysis chapter 08 official
Introductory maths analysis   chapter 08 officialIntroductory maths analysis   chapter 08 official
Introductory maths analysis chapter 08 official
 
Chapter 8 - Introduction to Probability and Statistics
Chapter 8 - Introduction to Probability and StatisticsChapter 8 - Introduction to Probability and Statistics
Chapter 8 - Introduction to Probability and Statistics
 
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
Chapter8 introductiontoprobabilityandstatistics-151003150859-lva1-app6892
 
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
0862_LowerSecondary_Mathematics_ProgressionGrid_tcm143-592637.docx
 
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docxISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
 
Unit 8 Fifth Grade cs 2012 2013
Unit 8 Fifth Grade cs 2012 2013Unit 8 Fifth Grade cs 2012 2013
Unit 8 Fifth Grade cs 2012 2013
 
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
Workshop 1 (Mathematics)_)Regional Training on Instrumentation and Improvisat...
 
Quantitative techniques
Quantitative techniquesQuantitative techniques
Quantitative techniques
 
Rt graphical representation
Rt graphical representationRt graphical representation
Rt graphical representation
 
Project3
Project3Project3
Project3
 
Contribution of mathematician1.pptx
Contribution of mathematician1.pptxContribution of mathematician1.pptx
Contribution of mathematician1.pptx
 
mathlab-lotty.pptx
mathlab-lotty.pptxmathlab-lotty.pptx
mathlab-lotty.pptx
 
G12 graders - Graphing Distributions (Quantitative).pptx
G12 graders - Graphing Distributions (Quantitative).pptxG12 graders - Graphing Distributions (Quantitative).pptx
G12 graders - Graphing Distributions (Quantitative).pptx
 
A String Sculpture Illustrating Fermat's Little Theorem
A String Sculpture Illustrating Fermat's Little TheoremA String Sculpture Illustrating Fermat's Little Theorem
A String Sculpture Illustrating Fermat's Little Theorem
 
Unit 9 Fifth Grade cs 2012 2013
Unit 9 Fifth Grade cs 2012 2013Unit 9 Fifth Grade cs 2012 2013
Unit 9 Fifth Grade cs 2012 2013
 
(8) Lesson 7.5 - Similar Triangles and Indirect measurement
(8) Lesson 7.5 - Similar Triangles and Indirect measurement(8) Lesson 7.5 - Similar Triangles and Indirect measurement
(8) Lesson 7.5 - Similar Triangles and Indirect measurement
 
(8) Lesson 9.4
(8) Lesson 9.4(8) Lesson 9.4
(8) Lesson 9.4
 
Math-Stage-8-Scheme-of-Work.docx
Math-Stage-8-Scheme-of-Work.docxMath-Stage-8-Scheme-of-Work.docx
Math-Stage-8-Scheme-of-Work.docx
 
Differentiated instruction
Differentiated instructionDifferentiated instruction
Differentiated instruction
 
(8) Lesson 9.2
(8) Lesson 9.2(8) Lesson 9.2
(8) Lesson 9.2
 

More from Abdul Rahman Sherzad

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Abdul Rahman Sherzad
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation Snippets
Abdul Rahman Sherzad
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
Abdul Rahman Sherzad
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQL
Abdul Rahman Sherzad
 
PHP Variable variables Examples
PHP Variable variables ExamplesPHP Variable variables Examples
PHP Variable variables Examples
Abdul Rahman Sherzad
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Abdul Rahman Sherzad
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and Awareness
Abdul Rahman Sherzad
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
Abdul Rahman Sherzad
 
Mobile Score Notification System
Mobile Score Notification SystemMobile Score Notification System
Mobile Score Notification System
Abdul Rahman Sherzad
 
Herat Innovation Lab 2015
Herat Innovation Lab 2015Herat Innovation Lab 2015
Herat Innovation Lab 2015
Abdul Rahman Sherzad
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan Universities
Abdul Rahman Sherzad
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
Abdul Rahman Sherzad
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
Abdul Rahman Sherzad
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and Answers
Abdul Rahman Sherzad
 
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
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
Abdul Rahman Sherzad
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Abdul Rahman Sherzad
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
Abdul Rahman Sherzad
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Abdul Rahman Sherzad
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI Examples
Abdul Rahman Sherzad
 

More from Abdul Rahman Sherzad (20)

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation Snippets
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQL
 
PHP Variable variables Examples
PHP Variable variables ExamplesPHP Variable variables Examples
PHP Variable variables Examples
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and Awareness
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
 
Mobile Score Notification System
Mobile Score Notification SystemMobile Score Notification System
Mobile Score Notification System
 
Herat Innovation Lab 2015
Herat Innovation Lab 2015Herat Innovation Lab 2015
Herat Innovation Lab 2015
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan Universities
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and Answers
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI Examples
 

Recently uploaded

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 

Recently uploaded (20)

Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 

Cross Join Example and Applications

  • 1. CROSS JOIN APPLICATIONS Abdul Rahman Sherzad Computer Science Lecturer Herat University, Afghanistan
  • 2. Definition ■ Cross joins are used to return every combination of rows from two and more than two tables. ■ Cross Joins are sometimes called a Cartesian product. 2
  • 3. Example 1: Product and Size ■ Suppose you want every combination of product table and size table, as illustrated below: 3
  • 4. Example 2: Product and Color ■ Suppose you want every combination of product/item table and color table, as illustrated below: 4
  • 5. Example 3: Product, Size and Color ■ Suppose you want every combination of product table, size table, and color table, as illustrated below: 5
  • 6. Example 4: Student and Subject ■ Suppose you want to print every combination of Student table and Subject table to record their marks, as illustrated below: 6
  • 7. Example 5: Scenario ■ Calculating students’ attendance in comparison to the subjects’ requirement: – Let’s consider an example where the faculty would like to know students’ attendance against the subjects’ requirements. Also, let’s suppose some subjects are offered by several faculties, even different universities. Hence students can attend those subjects at different locations. ■ In such a scenario, the cross join is required to identify those students which did not attended some of the subjects at all. Then a left outer join is required to be used as a final step. 7
  • 8. Example 5: Inputs Subjects Attendance Requirement Students Attendance Records 8
  • 9. Example 5: Cross Join Subjects Attendance Requirement CROSS JOIN Students Attendance Records The cross join successfully identified subject “Math” where student “20003” did not attend it at all. 9
  • 10. Example 5: Left Outer Join Left Outer Join of the Cross-Join output with Students Attendance Records total as the final step. 10
  • 11. Example 6 – Deck of Cards ■ This is another interesting example of Cross Join demonstrating the true application of Cartesian Product – This example may not be very practical but very useful in teaching ■ Standard Deck of Cards – The standard playing card ranks {Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King} form a 13-element set. – The card suits {space ♠, heart ♥, diamond ♦, club ♣} form a four-element set. – The Cross Join (Cartesian product) of these sets returns a 52-element set consisting of 52 ordered pairs, which correspond to all 52 possible playing cards. 11
  • 12. Example 6 – Inputs Card suits Playing card ranks 12
  • 14. 14 If you do not challenge yourself, you will never realize what you can become.