• Like
Joins and unions in Sql
Upcoming SlideShare
Loading in...5
×
Uploaded on

Joins and unions in Sql

Joins and unions in Sql

More in: Education , Technology , Travel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
267
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Joins and Unions in SQL Server
  • 2. JOIN Operator An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them.
  • 3. 1.Cross joins SELECT <column list> FROM <left joined table> CROSS JOIN <right joined table> 2. Inner joins SELECT <column list> FROM <left joined table> [INNER] JOIN <right joined table> ON <join condition> 3. Outer joins SELECT <column list> FROM <left joined table> LEFT|RIGHT|FULL [OUTER] JOIN <right joined table> ON <join condition>
  • 4. UNION Operator The UNION operator is used to combine the result-set of two or more SELECT statements. Syntax SELECT column_name(s) FROM table1 UNION SELECT column_name(s) FROM table2;
  • 5. Difference between SQL JOIN and UNION 1.) The columns of joining tables may be different in JOIN but in UNION the number of columns and order of columns of all queries must be same. 2.) The UNION puts rows from queries after each other( puts vertically ) but JOIN puts the column from queries after each other (puts horizontally), i.e. it makes a cartesian product.
  • 6. 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
  • 7. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550
  • 8. THE END