SlideShare a Scribd company logo
1Using ORACLE®Retrieving data from multiple tables(joins)Sub-queries and Set operators
2JOINS
3USES OF JOINS
4EQUI JOINEqui Join is a simple SQL join condition that uses EQUAL sign as the comparison operator Syntax:SELECT col1,col2,col3 FROM table1,table2 WHERE table1.col1=table2.col1;EQUI JOIN on product_master and customer_master tables:SELECT prod_name,prod_stock,quantity,deliver_by                    FROM product_master,customer_master WHERE order_id=prod_id; By this we can have an approximation of the quantity and date of products that need to be shipped out.
5OUTER JOINSOUTER join condition returns all rows from both tables which satisfy the join condition along with rows which do not satisfy the join condition from one of the tables. The SQL outer join operator in Oracle is ( + ) and is used on one side of the join condition only.Syntax:SELECT col1,col2 FROM table1,table2 WHERE  table1.col1 (+) = table2.col1;OUTER JOIN on product_master table and customer_master:SELECTp.prod_id, p.prod_name, o.order_id, o.quantityFROM customer_master o, product_master pWHEREp.prod_id (+)= o.order_id  ;
6CARTESIAN JOINSIf a SQL join condition is omitted or if it is invalid the join operation will result in a Cartesian product. The Cartesian product returns a number of rows equal to the product of all rows in all the tables being joined. For example, if the first table has 20 rows and the second table has 10 rows, the result will be 20 * 10, or 200 rows. This query takes a long time to execute.SYNTAX:SELECT col1,col2 FROM table1,table2;CARTESIAN JOIN on product_master and customer_master:SELECTorder_id,prod_nameFROMcustomer_master,product_master;Here  each row from customer_master will be Mapped to each row of product_master.Here theThis query contains 50 rows only 10 rows are Shown in the figure
7SELF JOINSA Self join is the type of SQL join where we join a particular table to itself. Here it is necessary to ensure that the join statement defines an ALIAS name for both the copies of the tables to avoid column ambiguity Syntax for Table Alias:SELECTs.first_nameFROMstudent_details s;           In this query alias s is defined for the table student_details and the column first_name is selected from the table.Self Join on Course table:SELECTa.course_nameASCOURSE,b.course_nameAS PREREQUSITE_COURSEFROMcourse_ma,course_m bWHEREa.pre_course=b.course_id;
8NATURAL/CARTESIAN  JOINSCARTESIAN JOIN is also known as NATURAL JOIN .The output of this join can be filtered using the WHERE clause.SELECTprod_ID,prod_name ,order_id,quantityFROM product_masterNATURAL JOIN customer_masterWHERE prod_name LIKE ('teak%') AND quantity=10;
9SUBQUERY IN SQLA Subquery is also called as an Inner query or a Nested query. It is a query inside another query. A subquery is usually added in the WHERE Clause of the SQL statement.Most of the time, a subquery is used when we know how to search for a value using a SELECT statement, but do not know the exact value.Subqueries are an alternate way of returning data from multiple tablesSubqueries can be used with the following sql statements along with the comparision operators like =, <, >, >=, <= etc.Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators like IN, NOT IN in the where clause. 			SELECT column….. FROM tablename WHERE SUBQUERYrown……			The result set of the 			subquery act as the condition set for 				the main query 												row1The SELECT subquery statement
10SET OPERATORSSet operators combine the results of two component queries into a single result. Queries containing set operators are called compound queries.The Set Operators in SQL are:
11SET OPERATOR - UNIONThe UNION set operator is used to combine multiple subqueries and their outputs.The UNION clause merges the outputs of two or more subqueries into one in such a way that the Result set = Records only in query 1 + Records only in query 2 + A single set of records 	  	    common to both query 1 and query 2 .Example:SELECT * FROM InfoTable WHERE  age = 40			UNIONSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries
12SET OPERATOR - INTERSECTThe INTERSECT set operator is used to combine multiple subqueries and their outputs.The INTERSECT clause merges the outputs of two or more subqueries into one in such a way that the Result set = A single set of records common to both query 1 and query 2 .Example:SELECT * FROM InfoTable WHERE  age = 40			INTERSECTSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries
13SET OPERATOR - MINUSThe MINUS set operator is used to combine multiple subqueries and their outputs.The MINUS clause filters records from Second Query and common records and displays the remaining records.Result set = Records only in query 1 – [ Records only in query 2 + A single set of records 	  	    common to both query 1 and query 2 ].Example:SELECT * FROM InfoTable WHERE  age = 40			MINUSSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries and from Query 2 not included in the result set
THANK YOU14THANK YOU FOR VIEWING THIS PRESENTATIONFOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING ,please visit:  www.dataminingtools.net
Ad

More Related Content

What's hot (20)

MySQL Views
MySQL ViewsMySQL Views
MySQL Views
Reggie Niccolo Santos
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
baabtra.com - No. 1 supplier of quality freshers
 
Database Triggers
Database TriggersDatabase Triggers
Database Triggers
Aliya Saldanha
 
Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
I L0V3 CODING DR
 
oracle Sql constraint
oracle  Sql constraint oracle  Sql constraint
oracle Sql constraint
home
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
Swapnali Pawar
 
Subqueries
SubqueriesSubqueries
Subqueries
Randy Riness @ South Puget Sound Community College
 
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
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
bixxman
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
Syed Zaid Irshad
 
Sql joins
Sql joinsSql joins
Sql joins
Berkeley
 
Sql query [select, sub] 4
Sql query [select, sub] 4Sql query [select, sub] 4
Sql query [select, sub] 4
Dr. C.V. Suresh Babu
 
A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
Ram Sagar Mourya
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
Raveena Thakur
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
set operators.pptx
set operators.pptxset operators.pptx
set operators.pptx
Anusha sivakumar
 
SQL Server Learning Drive
SQL Server Learning Drive SQL Server Learning Drive
SQL Server Learning Drive
TechandMate
 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for Beginners
Product School
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 

Viewers also liked (20)

Oracle sql joins
Oracle sql joinsOracle sql joins
Oracle sql joins
redro
 
Sql joins
Sql joinsSql joins
Sql joins
Gaurav Dhanwant
 
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
Michael M David
 
Sql Patterns
Sql PatternsSql Patterns
Sql Patterns
phanleson
 
SQL UNION
SQL UNIONSQL UNION
SQL UNION
Ritwik Das
 
Flash Presentation
Flash PresentationFlash Presentation
Flash Presentation
Samuel Adams, MBA
 
oracle joins and sql joins
oracle joins and sql joinsoracle joins and sql joins
oracle joins and sql joins
shripal singh
 
Something about oracle joins
Something about oracle joinsSomething about oracle joins
Something about oracle joins
mysqlops
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
Jamshid Hashimi
 
Hash join
Hash joinHash join
Hash join
Heribertus Bramundito
 
Corba and-java
Corba and-javaCorba and-java
Corba and-java
afreen58
 
Join operation
Join operationJoin operation
Join operation
Jeeva Nanthini
 
Step By Step How To Install Oracle XE
Step By Step How To Install Oracle XEStep By Step How To Install Oracle XE
Step By Step How To Install Oracle XE
Achmad Solichin
 
Tutorial Instalisasi Oracle 10g dan Setting User
Tutorial Instalisasi Oracle 10g dan Setting UserTutorial Instalisasi Oracle 10g dan Setting User
Tutorial Instalisasi Oracle 10g dan Setting User
Imam Halim Mursyidin
 
Intro oracle10gexpress
Intro oracle10gexpressIntro oracle10gexpress
Intro oracle10gexpress
jatin Sareen
 
Intro to Application Express
Intro to Application ExpressIntro to Application Express
Intro to Application Express
José Angel Ibarra Espinosa
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash Join
Ajay Gupte
 
Oracle intro to designer abridged
Oracle intro to designer abridgedOracle intro to designer abridged
Oracle intro to designer abridged
FITSFSd
 
Sql server ___________ (advance sql)
Sql server  ___________  (advance sql)Sql server  ___________  (advance sql)
Sql server ___________ (advance sql)
Ehtisham Ali
 
Time-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy QueriesTime-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy Queries
Chema Alonso
 
Oracle sql joins
Oracle sql joinsOracle sql joins
Oracle sql joins
redro
 
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
ANSI SQL Transparent Multipath Hierarchical Structured Data Processing for Re...
Michael M David
 
Sql Patterns
Sql PatternsSql Patterns
Sql Patterns
phanleson
 
oracle joins and sql joins
oracle joins and sql joinsoracle joins and sql joins
oracle joins and sql joins
shripal singh
 
Something about oracle joins
Something about oracle joinsSomething about oracle joins
Something about oracle joins
mysqlops
 
Corba and-java
Corba and-javaCorba and-java
Corba and-java
afreen58
 
Step By Step How To Install Oracle XE
Step By Step How To Install Oracle XEStep By Step How To Install Oracle XE
Step By Step How To Install Oracle XE
Achmad Solichin
 
Tutorial Instalisasi Oracle 10g dan Setting User
Tutorial Instalisasi Oracle 10g dan Setting UserTutorial Instalisasi Oracle 10g dan Setting User
Tutorial Instalisasi Oracle 10g dan Setting User
Imam Halim Mursyidin
 
Intro oracle10gexpress
Intro oracle10gexpressIntro oracle10gexpress
Intro oracle10gexpress
jatin Sareen
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash Join
Ajay Gupte
 
Oracle intro to designer abridged
Oracle intro to designer abridgedOracle intro to designer abridged
Oracle intro to designer abridged
FITSFSd
 
Sql server ___________ (advance sql)
Sql server  ___________  (advance sql)Sql server  ___________  (advance sql)
Sql server ___________ (advance sql)
Ehtisham Ali
 
Time-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy QueriesTime-Based Blind SQL Injection using Heavy Queries
Time-Based Blind SQL Injection using Heavy Queries
Chema Alonso
 
Ad

Similar to Oracle: Joins (20)

Query
QueryQuery
Query
Raj Devaraj
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
Pooja Dixit
 
MULTIPLE TABLES
MULTIPLE TABLES MULTIPLE TABLES
MULTIPLE TABLES
ASHABOOPATHY
 
OPerators.pptx Best topics dbms. Good one
OPerators.pptx Best topics dbms.   Good oneOPerators.pptx Best topics dbms.   Good one
OPerators.pptx Best topics dbms. Good one
ksrilakshmia8
 
Sql joins
Sql joinsSql joins
Sql joins
Vivek Singh
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
Brian Foote
 
Chapter9 more on database and sql
Chapter9 more on database and sqlChapter9 more on database and sql
Chapter9 more on database and sql
KV(AFS) Utarlai, Barmer (Rajasthan)
 
Sql Queries
Sql QueriesSql Queries
Sql Queries
webicon
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
Chhom Karath
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
PADYALAMAITHILINATHA
 
Assignment 4
Assignment 4Assignment 4
Assignment 4
SneaK3
 
SQL Query
SQL QuerySQL Query
SQL Query
Imam340267
 
Babitha2.mysql
Babitha2.mysqlBabitha2.mysql
Babitha2.mysql
banubabitha
 
Babitha2 Mysql
Babitha2 MysqlBabitha2 Mysql
Babitha2 Mysql
banubabitha
 
e computer notes - Advanced subqueries
e computer notes - Advanced subqueriese computer notes - Advanced subqueries
e computer notes - Advanced subqueries
ecomputernotes
 
MYSQL using set operators
MYSQL using set operatorsMYSQL using set operators
MYSQL using set operators
Ahmed Farag
 
SQLSERVERQUERIES.pptx
SQLSERVERQUERIES.pptxSQLSERVERQUERIES.pptx
SQLSERVERQUERIES.pptx
ssuser6bf2d1
 
1. dml select statement reterive data
1. dml select statement reterive data1. dml select statement reterive data
1. dml select statement reterive data
Amrit Kaur
 
Structure query language, database course
Structure query language, database courseStructure query language, database course
Structure query language, database course
yunussufyan2024
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
Manikanda kumar
 
OPerators.pptx Best topics dbms. Good one
OPerators.pptx Best topics dbms.   Good oneOPerators.pptx Best topics dbms.   Good one
OPerators.pptx Best topics dbms. Good one
ksrilakshmia8
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
Brian Foote
 
Sql Queries
Sql QueriesSql Queries
Sql Queries
webicon
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
Chhom Karath
 
Assignment 4
Assignment 4Assignment 4
Assignment 4
SneaK3
 
e computer notes - Advanced subqueries
e computer notes - Advanced subqueriese computer notes - Advanced subqueries
e computer notes - Advanced subqueries
ecomputernotes
 
MYSQL using set operators
MYSQL using set operatorsMYSQL using set operators
MYSQL using set operators
Ahmed Farag
 
SQLSERVERQUERIES.pptx
SQLSERVERQUERIES.pptxSQLSERVERQUERIES.pptx
SQLSERVERQUERIES.pptx
ssuser6bf2d1
 
1. dml select statement reterive data
1. dml select statement reterive data1. dml select statement reterive data
1. dml select statement reterive data
Amrit Kaur
 
Structure query language, database course
Structure query language, database courseStructure query language, database course
Structure query language, database course
yunussufyan2024
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
Manikanda kumar
 
Ad

More from oracle content (13)

Oracle: Procedures
Oracle: ProceduresOracle: Procedures
Oracle: Procedures
oracle content
 
Oracle: PLSQL Introduction
Oracle: PLSQL IntroductionOracle: PLSQL Introduction
Oracle: PLSQL Introduction
oracle content
 
Oracle : DML
Oracle : DMLOracle : DML
Oracle : DML
oracle content
 
Oracle: Programs
Oracle: ProgramsOracle: Programs
Oracle: Programs
oracle content
 
Oracle: Commands
Oracle: CommandsOracle: Commands
Oracle: Commands
oracle content
 
Oracle:Cursors
Oracle:CursorsOracle:Cursors
Oracle:Cursors
oracle content
 
Oracle: Control Structures
Oracle:  Control StructuresOracle:  Control Structures
Oracle: Control Structures
oracle content
 
Oracle: Dw Design
Oracle: Dw DesignOracle: Dw Design
Oracle: Dw Design
oracle content
 
Oracle: Basic SQL
Oracle: Basic SQLOracle: Basic SQL
Oracle: Basic SQL
oracle content
 
Oracle Warehouse
Oracle WarehouseOracle Warehouse
Oracle Warehouse
oracle content
 
Oracle: Functions
Oracle: FunctionsOracle: Functions
Oracle: Functions
oracle content
 
Oracle: New Plsql
Oracle: New PlsqlOracle: New Plsql
Oracle: New Plsql
oracle content
 
Oracle: Fundamental Of Dw
Oracle: Fundamental Of DwOracle: Fundamental Of Dw
Oracle: Fundamental Of Dw
oracle content
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 

Oracle: Joins

  • 1. 1Using ORACLE®Retrieving data from multiple tables(joins)Sub-queries and Set operators
  • 4. 4EQUI JOINEqui Join is a simple SQL join condition that uses EQUAL sign as the comparison operator Syntax:SELECT col1,col2,col3 FROM table1,table2 WHERE table1.col1=table2.col1;EQUI JOIN on product_master and customer_master tables:SELECT prod_name,prod_stock,quantity,deliver_by FROM product_master,customer_master WHERE order_id=prod_id; By this we can have an approximation of the quantity and date of products that need to be shipped out.
  • 5. 5OUTER JOINSOUTER join condition returns all rows from both tables which satisfy the join condition along with rows which do not satisfy the join condition from one of the tables. The SQL outer join operator in Oracle is ( + ) and is used on one side of the join condition only.Syntax:SELECT col1,col2 FROM table1,table2 WHERE table1.col1 (+) = table2.col1;OUTER JOIN on product_master table and customer_master:SELECTp.prod_id, p.prod_name, o.order_id, o.quantityFROM customer_master o, product_master pWHEREp.prod_id (+)= o.order_id ;
  • 6. 6CARTESIAN JOINSIf a SQL join condition is omitted or if it is invalid the join operation will result in a Cartesian product. The Cartesian product returns a number of rows equal to the product of all rows in all the tables being joined. For example, if the first table has 20 rows and the second table has 10 rows, the result will be 20 * 10, or 200 rows. This query takes a long time to execute.SYNTAX:SELECT col1,col2 FROM table1,table2;CARTESIAN JOIN on product_master and customer_master:SELECTorder_id,prod_nameFROMcustomer_master,product_master;Here each row from customer_master will be Mapped to each row of product_master.Here theThis query contains 50 rows only 10 rows are Shown in the figure
  • 7. 7SELF JOINSA Self join is the type of SQL join where we join a particular table to itself. Here it is necessary to ensure that the join statement defines an ALIAS name for both the copies of the tables to avoid column ambiguity Syntax for Table Alias:SELECTs.first_nameFROMstudent_details s; In this query alias s is defined for the table student_details and the column first_name is selected from the table.Self Join on Course table:SELECTa.course_nameASCOURSE,b.course_nameAS PREREQUSITE_COURSEFROMcourse_ma,course_m bWHEREa.pre_course=b.course_id;
  • 8. 8NATURAL/CARTESIAN JOINSCARTESIAN JOIN is also known as NATURAL JOIN .The output of this join can be filtered using the WHERE clause.SELECTprod_ID,prod_name ,order_id,quantityFROM product_masterNATURAL JOIN customer_masterWHERE prod_name LIKE ('teak%') AND quantity=10;
  • 9. 9SUBQUERY IN SQLA Subquery is also called as an Inner query or a Nested query. It is a query inside another query. A subquery is usually added in the WHERE Clause of the SQL statement.Most of the time, a subquery is used when we know how to search for a value using a SELECT statement, but do not know the exact value.Subqueries are an alternate way of returning data from multiple tablesSubqueries can be used with the following sql statements along with the comparision operators like =, <, >, >=, <= etc.Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators like IN, NOT IN in the where clause. SELECT column….. FROM tablename WHERE SUBQUERYrown…… The result set of the subquery act as the condition set for the main query row1The SELECT subquery statement
  • 10. 10SET OPERATORSSet operators combine the results of two component queries into a single result. Queries containing set operators are called compound queries.The Set Operators in SQL are:
  • 11. 11SET OPERATOR - UNIONThe UNION set operator is used to combine multiple subqueries and their outputs.The UNION clause merges the outputs of two or more subqueries into one in such a way that the Result set = Records only in query 1 + Records only in query 2 + A single set of records common to both query 1 and query 2 .Example:SELECT * FROM InfoTable WHERE age = 40 UNIONSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries
  • 12. 12SET OPERATOR - INTERSECTThe INTERSECT set operator is used to combine multiple subqueries and their outputs.The INTERSECT clause merges the outputs of two or more subqueries into one in such a way that the Result set = A single set of records common to both query 1 and query 2 .Example:SELECT * FROM InfoTable WHERE age = 40 INTERSECTSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries
  • 13. 13SET OPERATOR - MINUSThe MINUS set operator is used to combine multiple subqueries and their outputs.The MINUS clause filters records from Second Query and common records and displays the remaining records.Result set = Records only in query 1 – [ Records only in query 2 + A single set of records common to both query 1 and query 2 ].Example:SELECT * FROM InfoTable WHERE age = 40 MINUSSELECT * FROM InfoTable WHERE age = 45; Result SetRecords from Query 1Records from Query 2Query 1Query 2Records common to both Queries and from Query 2 not included in the result set
  • 14. THANK YOU14THANK YOU FOR VIEWING THIS PRESENTATIONFOR MORE PRESENTATIONS AND VIDEOS ON ORACLE AND DATAMINING ,please visit: www.dataminingtools.net