[go: up one dir, main page]

0% found this document useful (0 votes)
13 views11 pages

DB Report5

Uploaded by

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

DB Report5

Uploaded by

shawonsingha10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

LAB Report

CSE312: Database Management System Lab

Submitted To
Mr. Nokimul Hasan Arif (NHA)
Lecturer
Department of CSE, Daffodil International University

Submitted By

Student ID: 221-15-5290


Section: 61_Q
Student Name: Shawon Kumar Singha
LAB TASK

05
[Report Number]

Topic: join clause


2024
Date of Assignment Distribution: :03 November
Date of Assignment Submission: 10 November 2024

Task No. 05 Task Name: ER Diagram to code implement and find result using
join clause

Introduction :
The JOIN clause in SQL is used to combine rows from two or more tables
based on a related column between them.

Types of Joins
INNER JOIN: Returns only the records with matching values in both tables.

code:
SELECT columns
FROM table1
INNER JOIN table2
ON table1.common_column = table2.common_column;

LEFT JOIN (or LEFT OUTER JOIN): Returns all records from the left table
and the matched records from the right table. If there is no match, it returns
NULL for the right table’s columns.

code:
SELECT columns
FROM table1
LEFT JOIN table2
ON table1.common_column = table2.common_column;
RIGHT JOIN (or RIGHT OUTER JOIN): returns all records from the right
table and the matched records from the left table. If there is no match, it returns
NULL for the left table’s columns.

code:
SELECT columns
FROM table1
RIGHT JOIN table2
ON table1.common_column = table2.common_column;

FULL JOIN (or FULL OUTER JOIN): Returns records when there is a
match in either the left or right table. If there’s no match, NULL values are
returned for non-matching rows.

code:
SELECT columns
FROM table1
FULL JOIN table2
ON table1.common_column = table2.common_column;

Why Use JOIN?

● The JOIN method is efficient when you want to combine data from
multiple sources (tables or derived data) and apply a filter based on
aggregated data (like an average) without using a subquery in the WHERE
clause.
● The query is logically similar to the original one but uses JOIN to filter
the data.
Tables :
ERD to code implement :
Better View : Code_Implement_File , ERD File
Obtained Output:

Answer to the question no. 1:

Answer to the question no. 2:

Answer to the question no. 3:


\

Answer to question no. 4:

Answer to the question no. 5:

Conclusion :

The join clause is a query method to combine rows from different


tables based on a related column, enabling you to gather and analyze
relational data efficiently.

You might also like