Cash-back offer from April 14th to 21st, 2024: Get a flat 10% cash-back credited to your account for a minimum transaction of $50.Post Your Questions Today!

Question DetailsNormal
$ 50.00

CSC 352 / 452: DATABASE PROGRAMMING PROJECT | Q3 to Q7 Solution

Question posted by
Online Tutor Profile
request

CSC 352 / 452: DATABASE PROGRAMMING PROJECT

  • Please, remember that this is NOT a group project. So do not consult with anybody in class or outside class.
  • ·Please submit a text file containing all your programs to D2L before or on due date.
  • ·Please review your file before submitting it to make sure you have the correct one. It is your responsibility to ensure that you upload the correct file. If you submit a blank/wrong file, you will simply receive a grade of zero.

 

Your task is to build a PL/SQL-based application to insert and update records in a video rental store database and generate some reports.

 

The database consists of only the following essential tables.

 

3) [70 points] – video_search()

Create a procedure called video_search to search a video and display the VIDEO_NAME, VIDEO_COPY_ID, FORMAT, and COPY_STATUS of the video’s copies. In addition, the checkout dates (CHECKOUT_DATE) and due dates (DUE_DATE) are also displayed for unreturned copies. The damaged copies (COPY_STATUS = “D”) are excluded in your output. Sort your output by the VIDEO_NAME and then the VIDEO_COPY_ID.

The procedure header is

CREATE OR REPLACE PROCEDURE video_search
(
p_video_name     VARCHAR2,
p_video_format     VARCHAR2 DEFAULT NULL
)

Hint:     WHERE UPPER(video_name) like '%' || UPPER(p_video_name) ||  '%';

Testing the procedure

(If your output does not match mine EXACTLY, you will lose some points.)

•    EXEC video_search('ocean')
    Dbms Output:

    ***** 0 results found for ocean. *****

•    EXEC video_search('PRETTY WOMAN', 'Blu-Ray')
    Dbms Output:

    ***** 0 results found for PRETTY WOMAN (Blu-Ray). *****

•    EXEC video_search('Pretty Woman')
    Dbms Output:

    ***** 3 results found for Pretty Woman. (Available copies: 3) *****
 
    VIDEO_NAME           VIDEO_COPY_ID    FORMAT      COPY_STATUS    CHECKOUT_DATE       DUE_DATE
    ---------------------------------------------------------------------------------------------
    PRETTY WOMAN                  6000    VHS TAPE    Available
    PRETTY WOMAN                  6001    VHS TAPE    Available
    PRETTY WOMAN                  6015    DVD         Available

•    EXEC video_search('Another')
    Dbms Output:

       ***** 4 results found for Another. (Available copies: 2) *****
 
    VIDEO_NAME           VIDEO_COPY_ID    FORMAT      COPY_STATUS    CHECKOUT_DATE       DUE_DATE
    ---------------------------------------------------------------------------------------------
    DIE ANOTHER DAY               6010    VHS TAPE    Available
    DIE ANOTHER DAY               6011    VHS TAPE    Rented           20-APR-2015    04-MAY-2015
    DIE ANOTHER DAY               6014    DVD         Available
    DIE ANOTHER DAY               6016    BLU-RAY     Rented           01-MAY-2015    04-MAY-2015

•    EXEC video_search('ANOTHER', 'Dvd')
    Dbms Output:

    ***** 1 result found for ANOTHER (Dvd). (Available copies: 1) *****
 
    VIDEO_NAME           VIDEO_COPY_ID    FORMAT      COPY_STATUS    CHECKOUT_DATE       DUE_DATE
    ---------------------------------------------------------------------------------------------
    DIE ANOTHER DAY               6014    DVD         Available

•    EXEC video_search('Story')
    Dbms Output:

    ***** 7 results found for Story. (Available copies: 4) *****
 
    VIDEO_NAME           VIDEO_COPY_ID    FORMAT      COPY_STATUS    CHECKOUT_DATE       DUE_DATE
    ---------------------------------------------------------------------------------------------
    TOY STORY                     6002    VHS TAPE    Rented           09-APR-2015    23-APR-2015
    TOY STORY                     6003    VHS TAPE    Available
    TOY STORY                     6017    DVD         Rented           01-MAY-2015    08-MAY-2015
    TOY STORY 2                   6009    VHS TAPE    Available
    TOY STORY 2                   6018    DVD         Rented           28-APR-2015    05-MAY-2015
    TOY STORY 2                   6019    DVD         Available
    TOY STORY 2                   6020    BLU-RAY     Available

4) [70 Points] – video_checkout()

Create a procedure called video_checkout to record a new rental. When the video is successfully checked out, you need to insert a new record into the VIDEO_RENTAL_RECORD table and update the corresponding record in the VIDEO_COPY table. Otherwise, the action is denied.

The procedure header is

CREATE OR REPLACE PROCEDURE video_checkout
(    
p_member_id            NUMBER,
    p_video_copy_id         NUMBER,
    p_video_checkout_date     DATE
)

A member whose expiration date is less than the current date (sysdate) is not able to make a rental.

Consider the following special cases:
•    The value of p_member_id is not in the MEMBER_ID column of the MEMBER table.
•    The member’s expiration date is less than the current date.
•    The copy is not available (COPY_STATUS = “R” or “D”).
•    The value of p_video_checkout_date is greater than the current date.
•    How to calculate the due date? Checkout periods are determined by the values in the MAXIMUM_CHECKOUT_DAYS column. Hard coding is not allowed.
•    A member may have up to five (5) copies checked out at any one time.
(For example, Tom has five copies checked out; he cannot rent a copy before he returns one of the five copies he checked out.)
•    (CSC 452 only) Before a member returns a copy, he/she cannot rent a second copy of the same video title (VIDEO_TITLE_ID).         

You need to create/run some test cases.

5) [60 points] – video_return()

Create a procedure called video_return to change the rental status for that returned copy. When the copy is successfully checked in, you need to update both the VIDEO_RENTAL_RECORD table and the VIDEO_COPY table. Otherwise, the action is denied.

The procedure header is

CREATE OR REPLACE PROCEDURE video_return
(
p_video_copy_id         NUMBER,
p_video_return_date     DATE
)

Consider the following special cases:
•    The value of p_video_copy_id does not exist in the corresponding column of the VIDEO_COPY table.
•    The status (COPY_STATUS) of that copy is not “R” (rented).
•    The value of p_video_return_date is greater than the current date.

You need to create/run some test cases.

6) [25 points] - print_unreturned_video()

Create a procedure called print_unreturned_video to retrieve all the copies that a member hasn't returned. The output should include the member's ID, name, expiration date, first checkout date, last checkout date, the number of unreturned copies, video name (VIDEO_NAME), copy ID (VIDEO_COPY_ID), format, checkout date, and due date of the rentals. Sort the data by due date and then the video name. The procedure header is

CREATE OR REPLACE PROCEDURE print_unreturned_video
(
p_member_id NUMBER
)

Testing the procedure

(If your output does not match mine EXACTLY, you will lose some points.)

•    EXEC print_unreturned_video(90)

    Dbms Output:
    The member (id = 90) is not in the member table.

•    EXEC print_unreturned_video(2004)

    Dbms Output:
    ----------------------------------------
Member ID:               2004
Member Name:             JOHNSON
Expiration Date:         21-APR-2016
First Checkout Date:     01-MAY-2014
Last Checkout Date:      01-MAY-2014
----------------------------------------
Number of Unreturned Videos:  0
----------------------------------------

•    EXEC print_unreturned_video(2008)

    Dbms Output:
    ----------------------------------------
    Member ID:               2008
    Member Name:             SCOTT
    Expiration Date:         30-DEC-2011
    First Checkout Date:     N/A
    Last Checkout Date:      N/A
    ----------------------------------------
    Number of Unreturned Videos:  0
    ----------------------------------------

•    EXEC print_unreturned_video(2002)

    Dbms Output:
    ----------------------------------------
    Member ID:               2002
    Member Name:             JONES
    Expiration Date:         02-MAR-2016
    First Checkout Date:     04-MAR-2014
    Last Checkout Date:      01-MAY-2015
    ----------------------------------------
    Number of Unreturned Videos:  3
    ----------------------------------------
    Video Copy ID:   6016
    Video Name:      DIE ANOTHER DAY
    Format:          BLU-RAY
    Checkout Date: &n

Available Answer
$ 50.00

[Solved] CSC 352 / 452: DATABASE PROGRAMMING PROJECT | Q3 to Q7 Solution

  • This Solution has been Purchased 4 time
  • Submitted On 03 Jun, 2015 11:09:12
Answer posted by
Online Tutor Profile
solution
This Tutorial is rated A+ p...
Buy now to view the complete solution
Other Similar Questions
User Profile
Exper...

CSC 352 / 452 ASSIGNMENT #2 | Complete Solution

DECLARE EmpName varchar2(30); hire varchar2(40); pay varchar2(40); ManName varchar(30); hire1 varchar2(40); sal varchar2(40); name varchar2(30); maxSal varchar2(40); depId NUMBER; de...
User Profile
Acade...

CSC 352 / 452: DATABASE PROGRAMMING ASSIGNMENT #1

CSC 352 / 452: DATABASE PROGRAMMING ASSIGNMENT #1 (60 POINTS) Due on Tuesday, 1/12/2016 at 11:59PM Unless prior arrangements are made, homework turned in late but within 24 hours of the due time will be graded at 75% credit...
User Profile
Acade...

CSC 352 / 452: DATABASE PROGRAMMING

CSC 352 / 452: DATABASE PROGRAMMING ASSIGNMENT #2 (60 POINTS) Due on Tuesday, 1/19/2016 at 11:59PM Unless prior arrangements are made, homework turned in late but within 24 hours of the due time will be graded at 75% credit...
User Profile
Acade...

CSC 352 / 452: DATABASE PROGRAMMING

CSC 352 / 452: DATABASE PROGRAMMING ASSIGNMENT #1 (60 POINTS) Due on Tuesday, 1/12/2016 at 11:59PM Unless prior arrangements are made, homework turned in late but within 24 hours of the due time will be graded at 75% credit...
User Profile
Acade...

CSC 352 / 452: DATABASE PROGRAMMING

CSC 352 / 452: DATABASE PROGRAMMING ASSIGNMENT #1 (60 POINTS) Due on Tuesday, 1/12/2016 at 11:59PM Unless prior arrangements are made, homework turned in late but within 24 hours of the due time will be graded at 75% credit...

The benefits of buying study notes from CourseMerits

homeworkhelptime
Assurance Of Timely Delivery
We value your patience, and to ensure you always receive your homework help within the promised time, our dedicated team of tutors begins their work as soon as the request arrives.
tutoring
Best Price In The Market
All the services that are available on our page cost only a nominal amount of money. In fact, the prices are lower than the industry standards. You can always expect value for money from us.
tutorsupport
Uninterrupted 24/7 Support
Our customer support wing remains online 24x7 to provide you seamless assistance. Also, when you post a query or a request here, you can expect an immediate response from our side.
closebutton

$ 629.35