Answer the question
In order to leave comments, you need to log in
How to write correct sql query for filtering and displaying movies?
I have a table like this called joined_df:
+-------+--------------------+---------+----+-------+-----------------+
|movieId| title| genres|year|movieId| avg(rating)|
+-------+--------------------+---------+----+-------+-----------------+
| 1580|Men in Black (a.k...| Sci-Fi|1997| 1580|3.487878787878788|
| 1580|Men in Black (a.k...| Comedy|1997| 1580|3.487878787878788|
| 1580|Men in Black (a.k...| Action|1997| 1580|3.487878787878788|
| 2366| King Kong | Horror|1933| 2366| 3.64|
| 2366| King Kong | Fantasy|1933| 2366| 3.64|
| 2366| King Kong |Adventure|1933| 2366| 3.64|
| 2366| King Kong | Action|1933| 2366| 3.64|
| 3175| Galaxy Quest | Sci-Fi|1999| 3175| 3.58|
| 3175| Galaxy Quest | Comedy|1999| 3175| 3.58|
| 3175| Galaxy Quest |Adventure|1999| 3175| 3.58|
| 1088| Dirty Dancing | Romance|1987| 1088|3.369047619047619|
| 1088| Dirty Dancing | Musical|1987| 1088|3.369047619047619|
| 1088| Dirty Dancing | Drama|1987| 1088|3.369047619047619|
| 32460|Knockin' on Heave...| Drama|1997| 32460| 4.25|
| 32460|Knockin' on Heave...| Crime|1997| 32460| 4.25|
| 32460|Knockin' on Heave...| Comedy|1997| 32460| 4.25|
| 32460|Knockin' on Heave...| Action|1997| 32460| 4.25|
| 44022|Ice Age 2: The Me...| Comedy|2006| 44022|3.217391304347826|
| 44022|Ice Age 2: The Me...| Children|2006| 44022|3.217391304347826|
| 44022|Ice Age 2: The Me...|Animation|2006| 44022|3.217391304347826|
+-------+--------------------+---------+----+-------+-----------------+
only showing top 20 rows
ARG_GENRES = 'Sci-Fi|Action' #by default = '' фильтр по жанру
YEAR_TO = 2007 #by default = 2030. фильтр по году
YEAR_FROM = 1900 #by default = 1800 фильтр по году
REGEXP = 'Terminator' #by default = '' фильтр по названию фильма
N = 5 #by default = 10000 фильтр по количеству строк в выводимом результате
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question