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

3 2 Polynomial Functions And Their Graphs
3 2 Polynomial Functions And Their Graphs3 2 Polynomial Functions And Their Graphs
3 2 Polynomial Functions And Their Graphs
silvia
 
Graphs of polynomial functions
Graphs of polynomial functionsGraphs of polynomial functions
Graphs of polynomial functions
Carlos Erepol
 

Mais procurados (20)

Grade 8 Probability Cambridge [PPT]
Grade 8 Probability Cambridge [PPT]Grade 8 Probability Cambridge [PPT]
Grade 8 Probability Cambridge [PPT]
 
3 2 Polynomial Functions And Their Graphs
3 2 Polynomial Functions And Their Graphs3 2 Polynomial Functions And Their Graphs
3 2 Polynomial Functions And Their Graphs
 
Graphs of polynomial functions
Graphs of polynomial functionsGraphs of polynomial functions
Graphs of polynomial functions
 
Harmonic sequence and fibonacci 10
Harmonic sequence and fibonacci 10Harmonic sequence and fibonacci 10
Harmonic sequence and fibonacci 10
 
Sample space, events, outcomes, and experiments
Sample space, events, outcomes, and experimentsSample space, events, outcomes, and experiments
Sample space, events, outcomes, and experiments
 
Union and Intersection of Sets
Union and Intersection of SetsUnion and Intersection of Sets
Union and Intersection of Sets
 
Solving Problems Using Venn Diagram
Solving Problems Using Venn DiagramSolving Problems Using Venn Diagram
Solving Problems Using Venn Diagram
 
Independent and dependent events notes
Independent and dependent events notesIndependent and dependent events notes
Independent and dependent events notes
 
Quadratic inequality
Quadratic inequalityQuadratic inequality
Quadratic inequality
 
union and intersection of events.ppt
union and intersection of events.pptunion and intersection of events.ppt
union and intersection of events.ppt
 
G7 - Expressing Rational Numbers from Fraction to Decimal Form and vice versa...
G7 - Expressing Rational Numbers from Fraction to Decimal Form and vice versa...G7 - Expressing Rational Numbers from Fraction to Decimal Form and vice versa...
G7 - Expressing Rational Numbers from Fraction to Decimal Form and vice versa...
 
Factoring Polynomials
Factoring PolynomialsFactoring Polynomials
Factoring Polynomials
 
Properties of the Graph of a Linear Equation
Properties of the Graph of a Linear EquationProperties of the Graph of a Linear Equation
Properties of the Graph of a Linear Equation
 
Math 7 | Lesson 2 Set Operations and the Venn Diagram
Math 7 |  Lesson 2 Set Operations and the Venn DiagramMath 7 |  Lesson 2 Set Operations and the Venn Diagram
Math 7 | Lesson 2 Set Operations and the Venn Diagram
 
Math 8 – congruent triangles
Math 8 – congruent trianglesMath 8 – congruent triangles
Math 8 – congruent triangles
 
Law of Radicals.pptx
Law of Radicals.pptxLaw of Radicals.pptx
Law of Radicals.pptx
 
Measures of Position for Ungroup Data
Measures of Position for Ungroup DataMeasures of Position for Ungroup Data
Measures of Position for Ungroup Data
 
Adding and subtracting rational expressions
Adding and subtracting rational expressionsAdding and subtracting rational expressions
Adding and subtracting rational expressions
 
Combination
CombinationCombination
Combination
 
Polynomial Function and Synthetic Division
Polynomial Function and Synthetic DivisionPolynomial Function and Synthetic Division
Polynomial Function and Synthetic Division
 

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; Odds
Jason Aubrey
 
12.4 probability of compound events
12.4 probability of compound events12.4 probability of compound events
12.4 probability of compound events
hisema01
 
Probability Powerpoint
Probability PowerpointProbability Powerpoint
Probability Powerpoint
spike2904
 
4.4 probability of compound events
4.4 probability of compound events4.4 probability of compound events
4.4 probability of compound events
hisema01
 
Probability; Compound Event, Permutations
Probability; Compound Event, PermutationsProbability; Compound Event, Permutations
Probability; Compound Event, Permutations
Reversearp
 
Probability - Independent & Dependent Events
Probability - Independent & Dependent EventsProbability - Independent & Dependent Events
Probability - Independent & Dependent Events
Bitsy Griffin
 
10.6 compound events
10.6 compound events10.6 compound events
10.6 compound events
andreagoings
 
Lesson 11 5 compound events
Lesson 11 5 compound eventsLesson 11 5 compound events
Lesson 11 5 compound events
mlabuski
 
Conditional Probability
Conditional ProbabilityConditional Probability
Conditional Probability
shannonrenee4
 
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
Cryptic Mae Lazarte
 
Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)Chinese festivals中国节日(英文介绍)
Chinese festivals中国节日(英文介绍)
Michelle Fan
 
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
Jayant 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

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

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