Question 12 of 32beginner🔧 ApplyShort Answer1 mark

Consider the following MOVIE table and write the SQL queries based on it. List MovieID, MovieName and Cost for all movies with ProductionCost greater than 10,000 and less than 1,00,000.

Correct Answer

SELECT MovieID, MovieName, ProductionCost FROM MOVIE WHERE ProductionCost > 10000 AND ProductionCost < 100000;

Exercise: EXERCISE | Q: 3(e) | (Page 47)
For More Understanding

Explanation

This question tests the understanding of SELECT statement with conditional filtering using comparison operators. The query needs to display three columns (MovieID, MovieName, ProductionCost) from the MOVIE table where ProductionCost falls within a specific range. The question specifies 'greater than 10,000 and less than 1,00,000', which means we need to use the AND operator with > and < comparison operators. Note that BETWEEN operator is not suitable here because BETWEEN is inclusive (includes boundary values), whereas the question asks for values strictly greater than and strictly less than the specified limits. The column name in the table is 'ProductionCost', so we use that in both SELECT and WHERE clauses.

Solution Steps

  1. Step 1: Identify columns to display - MovieID, MovieName, ProductionCost

  2. Step 2: Identify table name - MOVIE

  3. Step 3: Apply filter condition - ProductionCost > 10000 AND ProductionCost < 100000

  4. Step 4: Write complete query: SELECT MovieID, MovieName, ProductionCost FROM MOVIE WHERE ProductionCost > 10000 AND ProductionCost < 100000;