0% found this document useful (0 votes)
11 views3 pages

SQL Join Queries for Palette Tables

The document provides examples of SQL queries to perform different types of joins between two tables named palette_a and palette_b. It includes examples of inner, left outer, right outer, and full outer joins, showing the syntax and sample queries for each join type. The inner join returns records that match in both tables, while the outer joins return all records from one or both tables, along with matched records from the other table.

Uploaded by

sarala devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

SQL Join Queries for Palette Tables

The document provides examples of SQL queries to perform different types of joins between two tables named palette_a and palette_b. It includes examples of inner, left outer, right outer, and full outer joins, showing the syntax and sample queries for each join type. The inner join returns records that match in both tables, while the outer joins return all records from one or both tables, along with matched records from the other table.

Uploaded by

sarala devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Write the sample queries to exercise all the joins – inner join, left outer join, right
outer join and full outer joins.

Tables used :

1) Palette_a 2) Palette_b

a) INNER JOIN

Description : Returns records that have matching values in both tables.

Syntax : SELECT column_name(s)


FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;

Example Query: select [Link],[Link],[Link],[Link]


from palette_a a
inner join palette_b b
on [Link]=[Link] ;

Output :

1
b) LEFT OUTER JOIN

Description : Returns all records from the left table, and the matched records
from the right table.

Syntax : SELECT column_name(s)


FROM table1
LEFT OUTER JOIN table2
ON table1.column_name = table2.column_name;

Example Query: select [Link],[Link],[Link],[Link]


from palette_a a
LEFT OUTER JOIN palette_b b
on [Link]=[Link] ;

Output :

c) RIGHT OUTER JOIN

Description : Returns all records from the right table, and the matched records
from the left table.

Syntax : SELECT column_name(s)


FROM table1
RIGHT OUTER JOIN table2
ON table1.column_name = table2.column_name;

2
Example Query: select [Link],[Link],[Link],[Link]
from palette_a a
RIGHT OUTER JOIN palette_b b
on [Link]=[Link] ;

Output :

d) FULL OUTER JOIN

Description : Returns all records when there is a match in either left or right
table.

Syntax : SELECT column_name(s)


FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name;

Example Query: select [Link],[Link],[Link],[Link]


from palette_a a
FULL OUTER JOIN palette_b b
on [Link]=[Link] ;

Output :

You might also like