Professional Documents
Culture Documents
Project 3: Data Manipulation Language (DML), Part 2 of 2
Project 3: Data Manipulation Language (DML), Part 2 of 2
1. (2 points)
b.) Via an SQL query, retrieve the 5 valid rows from your table of customers
from Project 2.
c.) Then, via another query, update the street address of one of your 5 customers
using their account numbers (you can simply “hardcode” this is the
command from visual inspection of your table of customers.
d.) Then delete one of your other 5 customers using his or her name (“hardcode”
name in command after table inspection).
f.) Then, via a single query, retrieve only the account numbers, last names, cities
and zip codes for all 10 customers, sorted by zip code and then account
number.
Show the SQL you use and the Oracle response (data and feedback) to the SQL
directly after the SQL.
2. (3 points)
a) Add 5 more movies (now 10 total with those of Project 2) 20 more videos
(now 30 total with those Project 2) with a mixture of movie title and types
(e.g. westem, romance, comedy). Add data to other tables as needed for
referential integrity and to provide a good sample of actor, actress, director
and award data.
b) Retrieve all 10 movies, showing title, movie ID, type, running length, rating,
year released, and all actors, sorted in ascending order by movie title.
c) Via a single query, retrieve those video renting (i.e., daily rental price) for
under $4.00, showing video ID, distributor name, wholesale purchase cost
from distributor, and current daily rental price to customers, sorted by
descending rental price and ascending video id within rental price.
Show the SQL you used and the Oracle responses (data and feedback) to the SQL
directly after each SQL statement.
a) Process 5 rental transactions on a single day (i.e. the “first” day) where your
customer 1 rent 1, customer 2 rent 2 videos, 3 rent 3, 4 rent 4, 5 rent 5 (You
can simply “hardcode” the customer account and video id number into these
commands from a visual inspection of your table)
Customer 1
Insert into rental (rental_id, cust_id, movie_id, no_of_copy, date_rented,
date_due)VALUES(‘R0001’,’C049’,’M0102’,1,to_date(‘01/03/00’,’mm/dd/yy
yy’),to_date(‘01/06/00’,’mm/dd/yyyy’));
Customer 2
Insert into rental(rental_id,cust_id, movie_id, no_of_copy, date_rented,
date_due)VALUES(‘R0002’,’C074’,’M050’,1,to_date(‘01/03/00’,’mm/dd/yyy
y’),to_date(‘01/06/00’,’mm/dd/yyyy’)),
(‘R0002’,’C074’,1,to_date(‘01/03/00’,’mm/dd/yyyy’),to_date(‘01/06/00’,’mm
/dd/yyyy’));
Customer 3
Insert into rental(rental_id,cust_id, movie_id, no_of_copy, date_rented,
date_due) VALUES(‘R0003’, ’C0202’, ’M0180’,1, todate(‘01/03/00’,
‘mm/dd/yyyy’),to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0003’,’C0202’,’M0190’,1,to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0003’,’C0202’,’M0191’,1,to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(’01/06/00’,’mm/dd/yyyy’));
Customer 4
Insert into rental(rental_id, cust_id, movie_id, no_of_copy, date_rented,
date_due)VALUES( ‘R0004’, ’C001’, ’M0192’, 1,
to_date(‘01/03/00’,’mm/dd/yyyy’),to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0004’, ‘C001’, ‘M0193’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0004’, ‘C001’, ‘M0194’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0004’, ‘C001’, ‘M0195’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’));
Customer 5
Insert into rental(rental_id, cust_id, movie_id, no_of_copy, date_rented,
date_due)VALUES( ‘R0005’, ’C002’, ’M0196’, 1,
to_date(‘01/03/00’,’mm/dd/yyyy’),to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0005’, ‘C002’, ‘M0197’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0005’, ‘C002’, ‘M0198’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0005’, ‘C002’, ‘M0199’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’),
(‘R0005’, ‘C002’, ‘M0200’, 1, to_date(‘01/03/00’,’mm/dd/yyyy’),
to_date(‘01/06/00’,’mm/dd/yyyy’));
b) On the next day, customer 3 returns all 3 videos and rents 3 more.