Database Systems Lab (CS-232 )
Database Systems - Lab 2
Namal University Mianwali
Faculty of Computer Science
Lab
Instruct Ms. Asiya Batool Dated 06-03-2024
or
Name MUHAMMAD SHAHBAZ Roll No 30
Max
10 Obtained Marks
Marks
Lab 02 – Lab Tasks
Note :
Use Sakila database that you created in the previous lab to execute the queries.
The schema of the database is given on last page.
Proper alias name should be displayed for column name in result instead of table column name. For
example Film ID should be displayed instead of film_id in the result.
All the required columns in the task should be displayed in the result.
Write SQL queries for the following tasks.
Task 1 Display Staff id and Full Name of Staff.
Query mysql> select staff_id AS ID,CONCAT(first_name ,last_name) AS FULLNAME from staff;
Output
Task 2 Display the description of the film with film_id 5.
Query mysql> select description AS DESCRIPTION ,film_id AS "FILM ID" from film where film_id=5;
Output
Task 3 List the rental rate and duration for film titles with a rental rate greater than $2.99.
mysql> select rental_duration AS "RENTAL DURATION" ,rental_rate AS "RENTAL RATE" from
Query
film where rental_rate>2.99;