Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

CpE EL1 – Software Development

LABORATORY REPORT: CONCEPT OF JOINS


Caringal, Alecxis T.
Computer Engineering, College of Engineering
Colegio San Agustin – Bacolod

Abstract

A JOIN clause is used to combine rows from two or more tables, based on a related column
between them. The purpose of this laboratory exercise is to learn the concepts of Joins and
implement it in SQL and database.

I. INTRODUCTION

Joint Multiple Table (Equi Join): Sometimes we require to treat more than one table as
though manipulate data from all the tables as though the tables were not separate object but one
single entity. To achieve this, we have to join tables. Tables are joined on column that have same
datatype and data with in tables. The tables that have to be joined are specified in the FROM clause
and the joining attributes in the WHERE clause.

Algorithm for JOIN in SQL:


1. Cartesian product of tables (specified in the FROM clause)
2. Selection of rows that match (predicate in the WHERE clause)
3. Project column specified in the SELECT clause.

The objectives of this laboratory experiment are the following:


1. Learn the concept of joins
2. Learn how to implement joins in SQL and database

II. IMPLEMENTATION

In this chapter will discuss about the laboratory exercise procedure. The procedures of this
laboratory experiment will guide about the data that I came up.

A. Using the format of INNER Join syntax.

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;

Figure 1. Using INNER Join to output rental ID, rental date, name of borrower and due date

B. Using LEFT JOIN


In number 2 question, I used the LEFT JOIN syntax. It will return all data from
borrowers_tbl, and the matched records from the right table (book_rental_tbl).

Figure 2. Using LEFT JOIN to output borrowers name, borrower ID and rental ID
C. Using RIGHT JOIN

CPE EL1 – SOFTWARE DEVELOPMENT Page 1 of 3


by: Engr. Jeremiah Dearborn F. Gangoso, CpE
In number 3 question, I used the RIGHT JOIN syntax. It will return all records from the right
table (supplier_tbl), and the matched records from the left table (books_tbl).

Figure 3. Using RIGHT JOIN to output book title, supplier name and location

III. EXPERIMENTAL FINDINGS

This chapter is about the presentation of the output that I gathered based on the laboratory
exercise given.

1. Rental ID, date of transaction, name of borrower and due date.

2. Rental ID and Borrower ID and Names

3. Book title, suppliers and supplier location

CPE EL1 – SOFTWARE DEVELOPMENT Page 2 of 3


by: Engr. Jeremiah Dearborn F. Gangoso, CpE
4. Rental ID, Books borrowed per person and respective titles.

IV. CONCLUSIONS

This laboratory exercise guides me to learn more on the concept of Joins. Through the
process, I learned how to implement the INNER join, LEFT join and RIGHT join in SQL. In
conclusion, I was able to understand how SQL works with join and the different types of join.

References

https://www.w3schools.com/sql/sql_join.asp
https://www.w3schools.com/sql/sql_join_left.asp

CPE EL1 – SOFTWARE DEVELOPMENT Page 3 of 3


by: Engr. Jeremiah Dearborn F. Gangoso, CpE

You might also like