Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following relational database schema: VIDEO= ( Title, RentalFee, Numbe

ID: 3745303 • Letter: G

Question

Given the following relational database schema:

VIDEO= ( Title, RentalFee, NumberOfDaysAllowed, Rating)

CUSTOMER= (FullName, PhoneNumber, Address, CreditCardN)

RENTALTRANSCATION= ( ID, Title, DateCheckOut, DateReturn, TotalFee, PhoneNumber, FullName)

Assume all dates are before the date of today and you may use <, >, =, and <> to compare any two dates. Write DDL statements to create the above tables and use appropriate data types for the attributes. The DDL statement must include at least the following constraints:

Every Primary Key;

Every Foreign Key;

For every Foreign Key constraint, the referential integrity constraints are:

ON DELETE SET NULL or CASCADE or DEFAULT whatever it is appropriate;

ON UPDATE SET NULL or CASCADE whatever it is appropriate;

Rating is either   PG, PG13, or R;

TotalFee = ( DateReturn – DateCheckOut)* RentalFee;

RentalFee >0;

RentalFee is not Null;

Explanation / Answer

For calculating the TotalFee , we can create a view like :

create VIEW TotalFee

AS

Select DateCheckOut,DateReturn, VIDEO.RentalFee ,((DateReturn-DateCheckOut)*VIDEO.RentalFee) As totalfare from

RENTALTRANSACTIONS Left JOIN VIDEO ON RENTALTRANSACTION.Title=VIDEO.Title

This view can be accessed easily using a select statement.

I hope this helps :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote