19.4k views
0 votes
Which SQL query outputs the number of films that are about a 'Mad Scientist'?

Option 1:
sql
Copy code
SELECT COUNT(*) FROM Films WHERE genre = 'Mad Scientist';
Option 2:
sql
Copy code
SELECT COUNT(*) FROM Films WHERE theme = 'Mad Scientist';
Option 3:
sql
Copy code
SELECT COUNT(*) FROM Films WHERE description LIKE '%Mad Scientist%';
Option 4:
sql
Copy code
SELECT COUNT(*) FROM Films WHERE keyword = 'Mad Scientist';

1 Answer

3 votes

Final answer:

The most suitable SQL query to find the number of films about a 'Mad Scientist' is: SELECT COUNT(*) FROM Films WHERE description LIKE '%Mad Scientist%'; This option searches the description field for any occurrences of the term, which is more flexible than searching in specific fields like genre or keyword.

Step-by-step explanation:

To find out the number of films that are about a 'Mad Scientist', it is necessary to understand the structure and semantics of the underlying database. We generally need to look for the term 'Mad Scientist' within an appropriate text field where such information would be stored. Given the options provided:

  • Option 1 assumes that 'Mad Scientist' is a genre, which seems unlikely.
  • Option 2 assumes there is a 'theme' column in the films table that could contain 'Mad Scientist'.
  • Option 3 checks for 'Mad Scientist' within the description field using a LIKE clause, which allows for partial matches and thus is the most flexible and likely correct choice. This is because films with this theme could mention 'Mad Scientist' anywhere within the description, not necessarily as a standalone genre or keyword.
  • Option 4 assumes there is a keyword field which exactly matches 'Mad Scientist', which is less flexible than a LIKE search in a description.

Therefore, the correct SQL query would likely be:

SELECT COUNT(*) FROM Films WHERE description LIKE '%Mad Scientist%';
User Thomas Collett
by
7.6k points