WHERE concept, I am not able to get the results for 'genre' columns

I am new to SQL, I am trying to use WHERE clause for imdb_rating and genre.

For example:

SELECT *
FROM movies
WHERE imdb_rating > 7 and genre = action;

but the query doesn’t show any result.

If I want to filter imdb_rating between greater than 6 and less than 7 I am getting the results.

SELECT *
FROM movies
WHERE imdb_rating > 6 and imdb_rating < 7;

Here I get the list in between 6 and 7 imdb rating movies.

But for genre I am not getting any results.

SQL - Query lesson Exercise 5

Thanks in advance :slight_smile:

Hi, welcome to the forums.

If you look at the schema, genre is TEXT…so you need quotation marks around text or a string in sql.

3 Likes

Hi Lisa,

Thanks for the clarification. :slight_smile:

2 Likes