Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

How can I retrieve all of the videos rented in the last 30 days

How can I retrieve all of the videos rented in the last 30 days and sort in chronological rental date order.

My code was unsuccessful

CREATE TABLE Rentals(

RentalID INT PRIMARY KEY,

InventoryID INT,

RateID INT,

DateRented DATE,

ReturnDate DATE,

CustomerID INT,

CONSTRAINT fk_Rnt_Inv FOREIGN KEY (InventoryID)

REFERENCES Inventory(InventoryID),

CONSTRAINT fk_Rnt_Rate FOREIGN KEY (RateID)

REFERENCES Rates(RateID),

CONSTRAINT fk_Rnt_Cus FOREIGN KEY (CustomerID)

REFERENCES Customers(CustomerID)

);

–Rentals–

INSERT INTO Rentals(RentalID, InventoryID, RateID, DateRented, ReturnDate, CustomerID)

VALUES(401, 1, 301, TO_DATE(‘2018/04/20’, ‘yyyy/mm/dd’), TO_DATE(‘2018/04/30’, ‘yyyy/mm/dd’), 101);

SQL>

SQL> SELECT * FROM Rentals

WHERE DateRented > SYSDATE – 30

ORDER BY DateRented; 2  3

no rows selected

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"