DBMS Lab 08 by Ali Ahmad - 373181

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

11/16/23

Ali Ahmad

373181

DBMS

Lab 08

Mam Ayman Aslam

Join Operations
Introduction:

In today's lab session, we continued relational databases and SQL queries, specifically
focusing on the practical application of JOIN operations. This lab included 8 tasks for joining
tables to extract information in meaningful ways. The primary purpose of this lab was to
combine information from multiple tables. By addressing real-world scenarios through SQL
queries, we learned to navigate complex database relationships and extract meaningful data
through JOINs.

Objectives:

• Category Inquiry: Identify the category of the movie "CHOCOLATE DUCK" by


executing a SQL query that utilizes JOIN operations to link movie titles with their
respective categories.
• Staff Location Tracking: Utilize JOIN operations to track the location (city and
country) of staff member "JON" by connecting relevant information from different
tables.
• Actor Details for a Movie: Retrieve the first and last names of actors who played in
the movie "ALONE TRIP" using JOIN operations to link movies with actors.
• Filtered Movie List: Generate a list of movies in the "Games" category with a rental
rate exceeding $4, sorted by movie titles, employing JOIN operations to combine
information from different tables.
Task 01:

Retreiving the category name ("Category") for the movie "Chocolate Duck" from the Sakila
database. It uses JOIN operations to link the category, film_category, and film tables based
on their respective identifiers, filtering the result based on the specified movie title.

Task 02:

To find the location (city and country) of staff member Jon, the query navigates through the
Sakila database, performing JOIN operations on the country, city, address, and staff tables,
filtering results based on the staff member's first name.
Task 03:

This query retrieves the first and last names of actors who played in the movie "Alone Trip"
by linking the actor, film_actor, and film tables through JOIN operations, filtering based on
the specified movie title.

Task 04:

To list movies in the "Games" category with a rental rate over $4, the query performs JOINs
on the film, film_category, and category tables, applying conditions on category name and
rental rate, and sorting the result alphabetically by movie title.
Task 05:

This query extracts the email addresses and corresponding movie titles of customers who
rented but did not pay. It involves JOIN operations on the customer, rental, inventory, film,
and payment tables, filtering results where the payment amount is zero.

Task 06:

To obtain a list of unpaid rentals with film title, rental ID, rental date, and duration, the query
navigates through the film, inventory, rental, and payment tables via JOIN operations,
filtering results where the payment amount is zero. List is ordered by film title and date.
Task 07:

By querying the film table, this command retrieves movie titles and descriptions containing
both "Crocodile" and "Shark" keywords, offering insights into films featuring these aquatic
elements.

Task 08:

This query retrieves language IDs for languages specified as "English" or "French" from the
language table, providing essential information for multilingual content identification.

You might also like