SlideShare una empresa de Scribd logo
1 de 12
JOINS IN DATABASE
Definition Of JOINS :-
   An SQL join clause combines
   records from two or more tables in a
   database. It creates a set that can be
   saved as a table or used as is. A JOIN
   is a means for combining fields from
   two tables by using values common
   to each.
Natural
        Join




Self   JOIN      Equi
Join             Join
        S


       Outer
       Join
 Natural Join - The NATURAL JOIN is a type of
 equi-join and is structured in such a way
 that, columns with same name of associate tables
 will appear once only.
         Eg - Select * FROM table1 NATURAL JOIN
 table2;


 EquiJoin - SQL EQUI JOIN performs a JOIN
 against equality or matching column(s) values of the
 associated tables. An equal sign (=) is used as
 comparison operator in the where clause to refer
 equality.
      Eg - Select column_list FROM
 table1, table2 WHERE table1.column_name
 =table2.column_name
 Self Join - SELF JOIN is used to join a table to
 itself, as if the table were two tables, temporarily
 renaming at least one table in the SQL statement.
    Eg - SELECT a.column_name, b.column_name FROM
    table1 a, table1 b WHERE a.common_filed =
    b.common_field;


 Outer Join –
   Right Outer Join -
   Left Outer Join
 Right Outer Join - The LEFT JOIN keyword returns
  all rows from the left table (table_name1), even if there
  are no matches in the right table (table_name2).
    Eg - SELECT column_name(s) FROM table_name1 LEFT JOIN
    table_name2 ON table_name1.column_name=table_name2.column_name


 Left Outer Join - The RIGHT JOIN keyword
  returns all the rows from the right table
  (table_name2), even if there are no matches in the
  left table (table_name1).
         Eg -SELECT column_name(s) FROM table_name1 RIGHT JOIN
                              table_name2 ON
             table_name1.column_name=table_name2.column_name
   A SQL nested query is a SELECT query that is
    nested inside a SELECT, UPDATE, INSERT, or
    DELETE SQL query. Here is a simple example
    of SQL nested query:

Eg - SELECT Model FROM Product WHERE
 ManufacturerID IN (SELECT ManufacturerID
 FROM Manufacturer WHERE Manufacturer =
 'Dell')
 UNIONALL - Combines the results of two SELECT
 statements into one result set.

 SELECTCUST_NBR, NAME FROM CUSTOMER WHERE
 REGION_ID = 5 UNION ALL SELECT
 C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE
 C.CUST_NBR IN (SELECT O.CUST_NBR FROM
 CUST_ORDER O, EMPLOYEE E WHERE
 O.SALES_EMP_ID = E.EMP_ID AND E.LNAME =
 'MARTIN');
• UNION - Combines the results of two SELECT
  statements into one result set, and then
  eliminates any duplicate rows from that result
  set.

Eg - SELECT CUST_NBR, NAME FROM
 CUSTOMER WHERE REGION_ID = 5 UNION
 SELECT C.CUST_NBR, C.NAME FROM
 CUSTOMER C WHERE C.CUST_NBR IN
 (SELECT O.CUST_NBR FROM CUST_ORDER
 O, EMPLOYEE E WHERE O.SALES_EMP_ID =
 E.EMP_ID AND E.LNAME = 'MARTIN');
   MINUS - Takes the result set of one SELECT
    statement, and removes those rows that are also
    returned by a second SELECT statement.

   Eg - SELECT CUST_NBR, NAME FROM CUSTOMER
    WHERE REGION_ID = 5 MINUS SELECT
    C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE
    C.CUST_NBR IN (SELECT O.CUST_NBR FROM
    CUST_ORDER O, EMPLOYEE E WHERE
    O.SALES_EMP_ID = E.EMP_ID AND E.LNAME =
    'MARTIN');
   INTERSECT - Returns only those rows that are returned
    by each of two SELECT statements.

   Eg - SELECT CUST_NBR, NAME FROM CUSTOMER
    WHERE REGION_ID = 5 INTERSECT SELECT
    C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE
    C.CUST_NBR IN (SELECT O.CUST_NBR FROM
    CUST_ORDER O, EMPLOYEE E WHERE
    O.SALES_EMP_ID = E.EMP_ID AND E.LNAME =
    'MARTIN');
SQL

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

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
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
Relational algebra (basics)
Relational algebra (basics)Relational algebra (basics)
Relational algebra (basics)
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
joins in database
 joins in database joins in database
joins in database
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
SQL
SQLSQL
SQL
 
ER model
ER modelER model
ER model
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 
Lecture 4 sql {basics keys and constraints}
Lecture 4 sql {basics  keys and constraints}Lecture 4 sql {basics  keys and constraints}
Lecture 4 sql {basics keys and constraints}
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Join query
Join queryJoin query
Join query
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query Optimization
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Sql joins
Sql joinsSql joins
Sql joins
 
Database design process
Database design processDatabase design process
Database design process
 

Destacado

Sql server ___________ (advance sql)
Sql server  ___________  (advance sql)Sql server  ___________  (advance sql)
Sql server ___________ (advance sql)Ehtisham Ali
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesDataminingTools Inc
 
Sub join a query optimization algorithm for flash-based database
Sub join a query optimization algorithm for flash-based databaseSub join a query optimization algorithm for flash-based database
Sub join a query optimization algorithm for flash-based databaseZhichao Liang
 
Join(sql)
Join(sql)Join(sql)
Join(sql)인 이
 
Database Introduction - Join Query
Database Introduction - Join QueryDatabase Introduction - Join Query
Database Introduction - Join QueryDudy Ali
 
Joins in databases
Joins in databases Joins in databases
Joins in databases CourseHunt
 
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 UserImam Halim Mursyidin
 
Intro oracle10gexpress
Intro oracle10gexpressIntro oracle10gexpress
Intro oracle10gexpressjatin Sareen
 
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 XEAchmad Solichin
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - NormalizationMudasir Qazi
 
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 JoinAjay Gupte
 
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
 
Oracle intro to designer abridged
Oracle intro to designer abridgedOracle intro to designer abridged
Oracle intro to designer abridgedFITSFSd
 
Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationEhsan Hamzei
 

Destacado (20)

SQL JOIN Explained Visually
SQL JOIN Explained VisuallySQL JOIN Explained Visually
SQL JOIN Explained Visually
 
Sql server ___________ (advance sql)
Sql server  ___________  (advance sql)Sql server  ___________  (advance sql)
Sql server ___________ (advance sql)
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
 
My sql join
My sql joinMy sql join
My sql join
 
Sub join a query optimization algorithm for flash-based database
Sub join a query optimization algorithm for flash-based databaseSub join a query optimization algorithm for flash-based database
Sub join a query optimization algorithm for flash-based database
 
Database Join
Database JoinDatabase Join
Database Join
 
Join(sql)
Join(sql)Join(sql)
Join(sql)
 
Sql join
Sql  joinSql  join
Sql join
 
Database Introduction - Join Query
Database Introduction - Join QueryDatabase Introduction - Join Query
Database Introduction - Join Query
 
Scrum Model
Scrum ModelScrum Model
Scrum Model
 
Joins in databases
Joins in databases Joins in databases
Joins in databases
 
Intro to Application Express
Intro to Application ExpressIntro to Application Express
Intro to Application Express
 
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
 
Intro oracle10gexpress
Intro oracle10gexpressIntro oracle10gexpress
Intro oracle10gexpress
 
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
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - Normalization
 
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
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Oracle intro to designer abridged
Oracle intro to designer abridgedOracle intro to designer abridged
Oracle intro to designer abridged
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 

Similar a SQL (20)

Sql basics v2
Sql basics v2Sql basics v2
Sql basics v2
 
Chapter9 more on database and sql
Chapter9 more on database and sqlChapter9 more on database and sql
Chapter9 more on database and sql
 
Assignment 4
Assignment 4Assignment 4
Assignment 4
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
Sql
SqlSql
Sql
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
 
Interacting with Oracle Database
Interacting with Oracle DatabaseInteracting with Oracle Database
Interacting with Oracle Database
 
3)12th_L8_Join-Set-Operations.pdf
3)12th_L8_Join-Set-Operations.pdf3)12th_L8_Join-Set-Operations.pdf
3)12th_L8_Join-Set-Operations.pdf
 
Babitha2.mysql
Babitha2.mysqlBabitha2.mysql
Babitha2.mysql
 
Babitha2 Mysql
Babitha2 MysqlBabitha2 Mysql
Babitha2 Mysql
 
SQL : Structured Query Language
SQL : Structured Query LanguageSQL : Structured Query Language
SQL : Structured Query Language
 
Joins and unions
Joins and unionsJoins and unions
Joins and unions
 
Lab4 join - all types listed
Lab4   join - all types listedLab4   join - all types listed
Lab4 join - all types listed
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
Structured query language(sql)
Structured query language(sql)Structured query language(sql)
Structured query language(sql)
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdf
 

Último

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 

Último (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 

SQL

  • 2. Definition Of JOINS :- An SQL join clause combines records from two or more tables in a database. It creates a set that can be saved as a table or used as is. A JOIN is a means for combining fields from two tables by using values common to each.
  • 3. Natural Join Self JOIN Equi Join Join S Outer Join
  • 4.  Natural Join - The NATURAL JOIN is a type of equi-join and is structured in such a way that, columns with same name of associate tables will appear once only. Eg - Select * FROM table1 NATURAL JOIN table2;  EquiJoin - SQL EQUI JOIN performs a JOIN against equality or matching column(s) values of the associated tables. An equal sign (=) is used as comparison operator in the where clause to refer equality. Eg - Select column_list FROM table1, table2 WHERE table1.column_name =table2.column_name
  • 5.  Self Join - SELF JOIN is used to join a table to itself, as if the table were two tables, temporarily renaming at least one table in the SQL statement. Eg - SELECT a.column_name, b.column_name FROM table1 a, table1 b WHERE a.common_filed = b.common_field;  Outer Join –  Right Outer Join -  Left Outer Join
  • 6.  Right Outer Join - The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2). Eg - SELECT column_name(s) FROM table_name1 LEFT JOIN table_name2 ON table_name1.column_name=table_name2.column_name  Left Outer Join - The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1). Eg -SELECT column_name(s) FROM table_name1 RIGHT JOIN table_name2 ON table_name1.column_name=table_name2.column_name
  • 7. A SQL nested query is a SELECT query that is nested inside a SELECT, UPDATE, INSERT, or DELETE SQL query. Here is a simple example of SQL nested query: Eg - SELECT Model FROM Product WHERE ManufacturerID IN (SELECT ManufacturerID FROM Manufacturer WHERE Manufacturer = 'Dell')
  • 8.  UNIONALL - Combines the results of two SELECT statements into one result set.  SELECTCUST_NBR, NAME FROM CUSTOMER WHERE REGION_ID = 5 UNION ALL SELECT C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE C.CUST_NBR IN (SELECT O.CUST_NBR FROM CUST_ORDER O, EMPLOYEE E WHERE O.SALES_EMP_ID = E.EMP_ID AND E.LNAME = 'MARTIN');
  • 9. • UNION - Combines the results of two SELECT statements into one result set, and then eliminates any duplicate rows from that result set. Eg - SELECT CUST_NBR, NAME FROM CUSTOMER WHERE REGION_ID = 5 UNION SELECT C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE C.CUST_NBR IN (SELECT O.CUST_NBR FROM CUST_ORDER O, EMPLOYEE E WHERE O.SALES_EMP_ID = E.EMP_ID AND E.LNAME = 'MARTIN');
  • 10. MINUS - Takes the result set of one SELECT statement, and removes those rows that are also returned by a second SELECT statement.  Eg - SELECT CUST_NBR, NAME FROM CUSTOMER WHERE REGION_ID = 5 MINUS SELECT C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE C.CUST_NBR IN (SELECT O.CUST_NBR FROM CUST_ORDER O, EMPLOYEE E WHERE O.SALES_EMP_ID = E.EMP_ID AND E.LNAME = 'MARTIN');
  • 11. INTERSECT - Returns only those rows that are returned by each of two SELECT statements.  Eg - SELECT CUST_NBR, NAME FROM CUSTOMER WHERE REGION_ID = 5 INTERSECT SELECT C.CUST_NBR, C.NAME FROM CUSTOMER C WHERE C.CUST_NBR IN (SELECT O.CUST_NBR FROM CUST_ORDER O, EMPLOYEE E WHERE O.SALES_EMP_ID = E.EMP_ID AND E.LNAME = 'MARTIN');