SlideShare uma empresa Scribd logo
1 de 28
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Union and Intersection




         Zabeeb anwar
         zabeebanwar@gmail.com
         www.fb.com/zabeebanwar
         twitter.com/zabeebanwar
         in/linkedin.com/in/zabeeb
          9895599689
union
                       AUB
- AUB(OR) means the union of sets A and B
  contains all of the elements of both A and B.
Intersection
AÇB(AND) means the intersection of sets A
and B. This contains all of the elements which
are in both A and B.
Union and Intersection with empty
Union and Intersection in Psql
Union
- A hot startup is holding a special event and
  wants to send out invites for my marriage()
  to some of my best clients and also to some
  VIPs.
- Some of the VIPs are actually very supportive
  of the site and are clients too.
- What query will provide the complete set of
  people to invite avoiding duplicate records?
- Here is our data.
Union
• create database hotstartup;
• create table clients(name varchar);
  insert into clients values(‘Sharan');
  insert into clients values(‘Vineesh');
  insert into clients values(‘Bala');
  insert into clients values(‘Sheethal');
• create table vips(name varchar);
  insert into vips values(‘Reshmi');
  insert into vips values(‘Sheethal');
  insert into vips values(‘Anupa');
  insert into vips values(‘Ashwathy');
Union
• hotstartup=# select * from clients union select *
  from vips;
   name
  ----------------
   Sharan
   Vineesh
   Bala
   Sheethal
   Reshmi
   Anupa
   Ashwathy
  (7 rows)
Union All
• hotstartup=# select * from clients union all select * from vips;
       name
   ----------------
   Sharan
   Vineesh
   Bala
   Sheethal
   Reshmi
   sheethal
   Anupa
   Ashwathy
  (8 rows)
Intersect
• if I want to get the list of people who are both
  clients and VIP we can use INTERSECT.
• hotstartup=# select * from
  clients intersect select * from vips;
       name
  ----------------
   Sheethal
   (1 row)
Intersect All
•    Let's insert a Sheethal(duplicate name) into VIP’s.
      name
    ----------------
    Sharan
    Vineesh
    Bala
    Sheethal
     Sheethal
    (4 rows)

-select * from client intersect all select * from vips;
Intersect All
  name
 ----------------
  sheethal
  sheethal

   (2 rows)
- Sheethal appears in both tables twice so we
  find two matching pairs for her and hence two
  rows appears in the results.
Except
• I want everyone on the clients list EXCEPT those on
  the VIP list.
• select * from clients except select * from vips;
  name
  ----------------
  Sharan
  Vineesh
  Bala
Except All
• Let's insert a Sheethal(duplicate name) into clients.
    name
   ----------------
   Sharan
   Vineesh
   Bala
   Sheethal
  Sheethal
    (4 rows)
-select * from clients except all select * from vips;
Except All
 name
----------------
Sharan
Vineesh
Bala
Sheethal
 (4 rows)
Where Clause
• select * from Clients_Year;
       name         | Birth year
  ------------------+------
   Sharan        | 1976
   Vineesh | 1977
   Bala       | 1978
   Ashwathy | 1983
   Reshmi | 199 3
   sheethal | 1996
   Anupa        | 1997
Where Clause
• select * from clients_year where year
  between 1970 and 1979 union select * from
  ceos where year=1977;
    name        | Birth year
  ------------------+------
   Sharan | 1976
   Vineesh | 1977
   Bala         | 1978
Do not
• select * from clients where year between
  1970 and 1979 union select name from clients
  where year=1977;
  ERROR: each UNION query must have the
  same number of columns
Union and intersection in Python
Example
>>>engineers = Set(['John', 'Jane', 'Jack',
  'Janice'])

>>>programmers = Set(['Jack', 'Sam', 'Susan',
  'Janice'])

>>>managers = Set(['Jane', 'Jack', 'Susan',
  'Zack'])
Union
>>>employees = engineers | programmers |
  managers
>>>print “employees”
Set(['Jane', 'Janice', 'John’,
  'Jack’,’susan’,’Zack’,’sam’])
Intersection
>>>engineers = Set(['John', 'Jane', 'Jack',
  'Janice'])
>>>managers = Set(['Jane', 'Jack', 'Susan',
  'Zack'])
>>>engineering_management = engineers &
  managers
>>>print “engineering_management”
Set(['Jane', 'Jack’])
Questions
If this presentation helped you, please visit our
           page facebook.com/baabtra and like it.
                 Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us

Mais conteúdo relacionado

Mais procurados

Probability of Simple and Compound Events
Probability of Simple and Compound EventsProbability of Simple and Compound Events
Probability of Simple and Compound EventsJoey Valdriz
 
Introduction of Probability
Introduction of ProbabilityIntroduction of Probability
Introduction of Probabilityrey castro
 
permutations power point
permutations power pointpermutations power point
permutations power pointAldrin Balenton
 
Evaluating Algebraic Expressions
Evaluating Algebraic ExpressionsEvaluating Algebraic Expressions
Evaluating Algebraic Expressionsbizarregirl
 
The Fundamental Counting Principle
The Fundamental Counting PrincipleThe Fundamental Counting Principle
The Fundamental Counting PrincipleRon Eick
 
Math 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesMath 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesCarlo Luna
 
System of Linear inequalities in two variables
System of Linear inequalities in two variablesSystem of Linear inequalities in two variables
System of Linear inequalities in two variablesAnirach Ytirahc
 
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1Adding and Subtracting Polynomials - Math 7 Q2W4 LC1
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1Carlo Luna
 
mutually-exclusive-events.ppt
mutually-exclusive-events.pptmutually-exclusive-events.ppt
mutually-exclusive-events.pptJosephSPalileoJr
 
2.4 Linear Functions
2.4 Linear Functions2.4 Linear Functions
2.4 Linear Functionssmiller5
 
Rectangular coordinate system
Rectangular coordinate systemRectangular coordinate system
Rectangular coordinate systemCathy Francisco
 
Math 7 - 4th Quarter: Types of Sampling
Math 7 - 4th Quarter: Types of SamplingMath 7 - 4th Quarter: Types of Sampling
Math 7 - 4th Quarter: Types of SamplingChristine R
 

Mais procurados (20)

Probability of Simple and Compound Events
Probability of Simple and Compound EventsProbability of Simple and Compound Events
Probability of Simple and Compound Events
 
Lesson plan (inset demo)
Lesson plan (inset demo)Lesson plan (inset demo)
Lesson plan (inset demo)
 
Introduction of Probability
Introduction of ProbabilityIntroduction of Probability
Introduction of Probability
 
Permutation
PermutationPermutation
Permutation
 
permutations power point
permutations power pointpermutations power point
permutations power point
 
Circular permutation
Circular permutationCircular permutation
Circular permutation
 
Evaluating Algebraic Expressions
Evaluating Algebraic ExpressionsEvaluating Algebraic Expressions
Evaluating Algebraic Expressions
 
Circles
CirclesCircles
Circles
 
Permutation
PermutationPermutation
Permutation
 
The Fundamental Counting Principle
The Fundamental Counting PrincipleThe Fundamental Counting Principle
The Fundamental Counting Principle
 
Math 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesMath 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two Variables
 
System of Linear inequalities in two variables
System of Linear inequalities in two variablesSystem of Linear inequalities in two variables
System of Linear inequalities in two variables
 
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1Adding and Subtracting Polynomials - Math 7 Q2W4 LC1
Adding and Subtracting Polynomials - Math 7 Q2W4 LC1
 
mutually-exclusive-events.ppt
mutually-exclusive-events.pptmutually-exclusive-events.ppt
mutually-exclusive-events.ppt
 
distance formula
distance formuladistance formula
distance formula
 
Sample Space And Events
Sample Space And EventsSample Space And Events
Sample Space And Events
 
Arcs and Central Angles
Arcs and Central AnglesArcs and Central Angles
Arcs and Central Angles
 
2.4 Linear Functions
2.4 Linear Functions2.4 Linear Functions
2.4 Linear Functions
 
Rectangular coordinate system
Rectangular coordinate systemRectangular coordinate system
Rectangular coordinate system
 
Math 7 - 4th Quarter: Types of Sampling
Math 7 - 4th Quarter: Types of SamplingMath 7 - 4th Quarter: Types of Sampling
Math 7 - 4th Quarter: Types of Sampling
 

Destaque

Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; Odds
Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; OddsMath 1300: Section 8 -2 Union, Intersection, and Complement of Events; Odds
Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; OddsJason Aubrey
 
12.4 probability of compound events
12.4 probability of compound events12.4 probability of compound events
12.4 probability of compound eventshisema01
 
Probability Powerpoint
Probability PowerpointProbability Powerpoint
Probability Powerpointspike2904
 
PROBABILITY
PROBABILITYPROBABILITY
PROBABILITYVIV13
 
4.4 probability of compound events
4.4 probability of compound events4.4 probability of compound events
4.4 probability of compound eventshisema01
 
Probability; Compound Event, Permutations
Probability; Compound Event, PermutationsProbability; Compound Event, Permutations
Probability; Compound Event, PermutationsReversearp
 
Probability - Independent & Dependent Events
Probability - Independent & Dependent EventsProbability - Independent & Dependent Events
Probability - Independent & Dependent EventsBitsy Griffin
 
10.6 compound events
10.6 compound events10.6 compound events
10.6 compound eventsandreagoings
 
Lesson 11 5 compound events
Lesson 11 5 compound eventsLesson 11 5 compound events
Lesson 11 5 compound eventsmlabuski
 
Conditional Probability
Conditional ProbabilityConditional Probability
Conditional Probabilityshannonrenee4
 
Space craft,space probe,space station,space shuttle and rocket
Space craft,space probe,space station,space shuttle and rocketSpace craft,space probe,space station,space shuttle and rocket
Space craft,space probe,space station,space shuttle and rocketCryptic Mae Lazarte
 
Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)Michelle Fan
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & CombinationPuru Agrawal
 
Real life situation's example on PROBABILITY
Real life situation's example on PROBABILITYReal life situation's example on PROBABILITY
Real life situation's example on PROBABILITYJayant Namrani
 

Destaque (20)

Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; Odds
Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; OddsMath 1300: Section 8 -2 Union, Intersection, and Complement of Events; Odds
Math 1300: Section 8 -2 Union, Intersection, and Complement of Events; Odds
 
intersection and union
intersection and unionintersection and union
intersection and union
 
12.4 probability of compound events
12.4 probability of compound events12.4 probability of compound events
12.4 probability of compound events
 
Probability Powerpoint
Probability PowerpointProbability Powerpoint
Probability Powerpoint
 
PROBABILITY
PROBABILITYPROBABILITY
PROBABILITY
 
4.4 probability of compound events
4.4 probability of compound events4.4 probability of compound events
4.4 probability of compound events
 
Probability; Compound Event, Permutations
Probability; Compound Event, PermutationsProbability; Compound Event, Permutations
Probability; Compound Event, Permutations
 
Probability - Independent & Dependent Events
Probability - Independent & Dependent EventsProbability - Independent & Dependent Events
Probability - Independent & Dependent Events
 
Circular Permutation
Circular PermutationCircular Permutation
Circular Permutation
 
Sets in mathematics
Sets in mathematicsSets in mathematics
Sets in mathematics
 
10.6 compound events
10.6 compound events10.6 compound events
10.6 compound events
 
Lesson 11 5 compound events
Lesson 11 5 compound eventsLesson 11 5 compound events
Lesson 11 5 compound events
 
Conditional Probability
Conditional ProbabilityConditional Probability
Conditional Probability
 
Space craft,space probe,space station,space shuttle and rocket
Space craft,space probe,space station,space shuttle and rocketSpace craft,space probe,space station,space shuttle and rocket
Space craft,space probe,space station,space shuttle and rocket
 
Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & Combination
 
Social dance
Social danceSocial dance
Social dance
 
Ballroom dance
Ballroom danceBallroom dance
Ballroom dance
 
Real life situation's example on PROBABILITY
Real life situation's example on PROBABILITYReal life situation's example on PROBABILITY
Real life situation's example on PROBABILITY
 
Set concepts
Set conceptsSet concepts
Set concepts
 

Mais de baabtra.com - No. 1 supplier of quality freshers

Mais de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
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
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 

Último (20)

ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 

Union and intersection

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. Union and Intersection Zabeeb anwar zabeebanwar@gmail.com www.fb.com/zabeebanwar twitter.com/zabeebanwar in/linkedin.com/in/zabeeb 9895599689
  • 4. union AUB - AUB(OR) means the union of sets A and B contains all of the elements of both A and B.
  • 5. Intersection AÇB(AND) means the intersection of sets A and B. This contains all of the elements which are in both A and B.
  • 8. Union - A hot startup is holding a special event and wants to send out invites for my marriage() to some of my best clients and also to some VIPs. - Some of the VIPs are actually very supportive of the site and are clients too. - What query will provide the complete set of people to invite avoiding duplicate records? - Here is our data.
  • 9. Union • create database hotstartup; • create table clients(name varchar); insert into clients values(‘Sharan'); insert into clients values(‘Vineesh'); insert into clients values(‘Bala'); insert into clients values(‘Sheethal'); • create table vips(name varchar); insert into vips values(‘Reshmi'); insert into vips values(‘Sheethal'); insert into vips values(‘Anupa'); insert into vips values(‘Ashwathy');
  • 10. Union • hotstartup=# select * from clients union select * from vips; name ---------------- Sharan Vineesh Bala Sheethal Reshmi Anupa Ashwathy (7 rows)
  • 11. Union All • hotstartup=# select * from clients union all select * from vips; name ---------------- Sharan Vineesh Bala Sheethal Reshmi sheethal Anupa Ashwathy (8 rows)
  • 12. Intersect • if I want to get the list of people who are both clients and VIP we can use INTERSECT. • hotstartup=# select * from clients intersect select * from vips; name ---------------- Sheethal (1 row)
  • 13. Intersect All • Let's insert a Sheethal(duplicate name) into VIP’s. name ---------------- Sharan Vineesh Bala Sheethal Sheethal (4 rows) -select * from client intersect all select * from vips;
  • 14. Intersect All name ---------------- sheethal sheethal (2 rows) - Sheethal appears in both tables twice so we find two matching pairs for her and hence two rows appears in the results.
  • 15. Except • I want everyone on the clients list EXCEPT those on the VIP list. • select * from clients except select * from vips; name ---------------- Sharan Vineesh Bala
  • 16. Except All • Let's insert a Sheethal(duplicate name) into clients. name ---------------- Sharan Vineesh Bala Sheethal Sheethal (4 rows) -select * from clients except all select * from vips;
  • 18. Where Clause • select * from Clients_Year; name | Birth year ------------------+------ Sharan | 1976 Vineesh | 1977 Bala | 1978 Ashwathy | 1983 Reshmi | 199 3 sheethal | 1996 Anupa | 1997
  • 19. Where Clause • select * from clients_year where year between 1970 and 1979 union select * from ceos where year=1977; name | Birth year ------------------+------ Sharan | 1976 Vineesh | 1977 Bala | 1978
  • 20. Do not • select * from clients where year between 1970 and 1979 union select name from clients where year=1977; ERROR: each UNION query must have the same number of columns
  • 22. Example >>>engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>>programmers = Set(['Jack', 'Sam', 'Susan', 'Janice']) >>>managers = Set(['Jane', 'Jack', 'Susan', 'Zack'])
  • 23. Union >>>employees = engineers | programmers | managers >>>print “employees” Set(['Jane', 'Janice', 'John’, 'Jack’,’susan’,’Zack’,’sam’])
  • 24. Intersection >>>engineers = Set(['John', 'Jane', 'Jack', 'Janice']) >>>managers = Set(['Jane', 'Jack', 'Susan', 'Zack']) >>>engineering_management = engineers & managers >>>print “engineering_management” Set(['Jane', 'Jack’])
  • 26.
  • 27. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com