[go: up one dir, main page]

0% found this document useful (0 votes)
31 views6 pages

SQL Joins Lab Tasks & Solutions

The document outlines 10 tasks for a database management systems lab on SQL joins. The tasks involve writing queries to display data from related tables in various databases by joining the tables on common fields and applying different types of joins and filters.

Uploaded by

real.zuhaibkhan
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)
31 views6 pages

SQL Joins Lab Tasks & Solutions

The document outlines 10 tasks for a database management systems lab on SQL joins. The tasks involve writing queries to display data from related tables in various databases by joining the tables on common fields and applying different types of joins and filters.

Uploaded by

real.zuhaibkhan
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/ 6

Bahria University,

Karachi Campus

LAB EXPERIMENT NO.


04

LIST OF TASKS

TASK NO OBJECTIVE
A Display Product’s name and their supplier’s name (ContactName), whose supplier’s
name does not contain “A” and there should be at most 10 characters in Product’s name.
B Create a report showing order ID., OrderDate, EmployeeID, and the firstname and
LastName of the associated Employee. (Tables: Employees & Orders )
C Count no of Products’s against each Suppliers name. List only those products whose
count is less than 5.
D Display Titles and their quantity. Show only those records where quantity is less than 10
(Hint Pubs database, table title and sales)
E Display Book Title and publisher Names (pubs Database, Table Title and Publisher).
F Display name of those publishers who haven’t published any book yet.
G Display Authors name whose city is same (Author id should be different).
H Use cross join (Cartesian join) to Display Book Title and Publisher Name.
I Use two full joins to Display Product Name, Category Name and Supplier Name.
J Write a query to list the names of employees that belongs to the same location as the
employee named Nancy

Submitted On:
Date: 04/03/24
[Lab no. 04] [DATABASE MANAGEMENT SYSTEMS LAB]
[SQL Joins]

Task No. 01:


Display Product’s name and their supplier’s name (ContactName), whose supplier’s name does not contain “A”
and there should be at most 10 characters in Product’s name.

Solution:

Output:

Task No. 02:


Create a report showing order ID., OrderDate, EmployeeID, and the firstname and LastName of the associated
Employee. (Tables: Employees & Orders )

Solution:

Output:

Zuahib Shamsheer 02-131222-


104
[Lab no. 02] [DATABASE MANAGEMENT SYSTEMS LAB]
[SQL Joins]
Task No. 03:
Count no of Products’s against each Suppliers name. List only those products whose count is less than 5.

Solution:

Output:

Task No. 04:


Display Titles and their quantity. Show only those records where quantity is less than 10 (Hint Pubs database,
table title and sales)

Solution:

Output:

Zuhaib Shamsheer 02-131222-104


[Lab no. 02] [DATABASE MANAGEMENT SYSTEMS LAB]
[SQL Joins]
Task No. 05:
Display Book Title and publisher Names (pubs Database, Table Title and Publisher).

Solution:

Output:

Task No. 06:


Display name of those publishers who haven’t published any book yet.

Solution:

Output:

Zuhaib Shamsheer 02-131222-104


[Lab no. 02] [DATABASE MANAGEMENT SYSTEMS LAB]
[SQL Joins]
Task No. 07:
Display Authors name whose city is same (Author id should be different).

Solution:

Output:

Task No. 08:


Use cross join (Cartesian join) to Display Book Title and Publisher Name.

Solution:

Output:

Zuhaib Shamsheer 02-131222-104


[Lab no. 02] [DATABASE MANAGEMENT SYSTEMS LAB]
[SQL Joins]
Task No. 09:
Use two full joins to Display Product Name, Category Name and Supplier Name.

Solution:

Output:

Task No. 10:


Write a query to list the names of employees that belongs to the same location as the employee named Nancy

Solution:

Output:

Zuhaib Shamsheer 02-131222-104

You might also like