sqloracle-databasemaxaggregate-functionsoracle9i

A query that shows the cost within $2 of the most expensive film


TITLE   GEN DURATION    PRODUCTION_YEAR MED PURCHASE_PRICE  PURCHASE_   MOVIE_ID

those are my columns

I am using oracle 9i

Thanks to anyone who can help


Solution

  • You can use the MAX function in sub-query in WHERE clause as follows:

    SELECT * FROM MOVIE
     WHERE PURCHASE_PRICE >= (SELECT MAX(PURCHASE_PRICE) - 2 FROM MOVIE)