Database and Management System Lab Report: 7 SQL Joins Submitted To
Database and Management System Lab Report: 7 SQL Joins Submitted To
Database and Management System Lab Report: 7 SQL Joins Submitted To
Lab Report : 7
SQL Joins
Submitted To:
Sir Shahid Ali
Submitted By:
Muhammad Shoaib Nadeem
16-CP-76
Section :
Omega
Date:
23/3/2019
Department Of Computer Engineering
UET Taxila
Lab Objectives:
The SQL Joins clause is used to combine records from two or more tables in a database.
Lab Tasks:
1 2008/11/12 1000 3
2 2008/10/23 1600 3
3 2008/09/02 700 1
4 2008/09/03 300 1
Person Table:
QUERY
Output
Order Table
QUERY
Create Table Orders_7(
Order_id int not null primary key,
OrderDate date,
OrderPrice int,
Per_ID int,
);
Output
Query
Apply Left Join (or left outer join) on above tables and show the result.
Query
Output
Apply Right Join (or right outer join) on above tables and show the result.
Query
Output
Apply Full Join (or Full outer join) on above tables and show the result.
Query
Output
Summary
The SQL Joins clause is used to combine records from two or more tables in a database. A JOIN is
a means for combining fields from two tables by using values common to each.
LEFT JOIN − returns all rows from the left table, even if there are no matches in the right table.
RIGHT JOIN − returns all rows from the right table, even if there are no matches in the left table.
FULL JOIN − returns rows when there is a match in one of the tables.
SELF JOIN − is used to join a table to itself as if the table were two tables, temporarily renaming at
least one table in the SQL statement.
CARTESIAN JOIN − returns the Cartesian product of the sets of records from the two or more joined
tables.