how and when the SQL joins statements are used, Database Qusetions help

User Generated

cebsznxzrqr

Computer Science

Description

Explain with help of examples how and when the  SQL joins statements are used,  the examples should clearly state the differences.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

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
...

Similar Content

Related Tags