Description
Explain with help of examples how and when the SQL joins statements are used, the examples should clearly state the differences.
Explanation & Answer
Attached.
SQL Joins
SQL Joins
Joins put the "relational" in relational databases by enabling you to relate the data in one
table with data in other tables.
The basic form of a join is sometimes described as an inner join . Joining tables is a
matter of specifying equality in columns from two tables:
SELECT book.title, author.name
FROM author, book
WHERE book.author = author.id
This query pulls columns from two different tables where a relationship exists between
rows in the two tables.
Specifically, this query looks for situations in which the value of the author column in
the book table matches the id value in the author table. Consider a database in which the
book
table looks like Table 3-3 and the author table looks like Table 3-4.
Table 3-3. A book table
ID
Title
Author
Pages
1
The Green Mile
4
894
2
Guards, Guards!
2
302
3
Imzadi
3
354
4
Gold
1
405
5
Howling Mad
3
294
Table 3-4. An author table
ID
Name
Citizen
1
...
24/7 Study Help
Stuck on a study question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Similar Content
Related Tags
Into the Wild
by Jon Krakauer
Where the Crawdads Sing
by Delia Owens
Rules Of Civility
by Amor Towles
The Outsiders
by S.E. Hinton
The Girl With The Dragon Tattoo
by Stieg Larsson
Oliver Twist
by Charles Dickens
Team of Vipers
by Cliff Sims
Epic of Gilgamesh
by Unknown
To Kill a Mockingbird
by Harper Lee