File size: 17,750 Bytes
1419886
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
description,query
"List all films in the database.","SELECT * FROM films;"
"Retrieve the details of a specific film by its ID.","SELECT * FROM films WHERE id = 1;"
"Retrieve the details of films released in a specific year.","SELECT * FROM films WHERE release_year = 2022;"
"Retrieve the details of films with a rating higher than a certain value.","SELECT * FROM films WHERE rating > 4.0;"
"Retrieve the details of films with a review containing specific keywords.","SELECT * FROM films WHERE review LIKE '%great%';"
"Retrieve the details of films watched at a specific time.","SELECT * FROM films WHERE watched_time = '2022-01-01';"
"Retrieve the number of films in the database.","SELECT COUNT(*) FROM films;"
"Retrieve the average rating of all films in the database.","SELECT AVG(rating) FROM films;"
"Retrieve the details of the top 10 highest-rated films.","SELECT * FROM films ORDER BY rating DESC LIMIT 10;"
"Retrieve the details of films released after a certain year.","SELECT * FROM films WHERE release_year > 2020;"
"Retrieve the details of films with a rating within a specific range.","SELECT * FROM films WHERE rating BETWEEN 3.0 AND 4.5;"
"Retrieve the details of films with a specific name.","SELECT * FROM films WHERE film_name = 'The Matrix';"
"Retrieve the highest rating among all films.","SELECT MAX(rating) FROM films;"
"Retrieve the lowest release year among all films.","SELECT MIN(release_year) FROM films;"
"Retrieve the total count of films watched.","SELECT COUNT(*) FROM films WHERE watched_time IS NOT NULL;"
"Calculate the average rating of films released after 2000.","SELECT AVG(rating) FROM films WHERE release_year > 2000;"
"Count the number of films released each year.","SELECT release_year, COUNT(*) FROM films GROUP BY release_year;"
"Calculate the total sum of ratings for all films.","SELECT SUM(rating) FROM films;"
"Find the average rating of films watched in 2022.","SELECT AVG(rating) FROM films WHERE strftime('%Y', watched_time) = '2022';"
"Retrieve the number of films with a review containing more than 100 characters.","SELECT COUNT(*) FROM films WHERE LENGTH(review) > 100;"
"Calculate the total count of films watched per month.","SELECT strftime('%m', watched_time) AS month, COUNT(*) FROM films WHERE watched_time IS NOT NULL GROUP BY month;"
"Retrieve the release year with the highest number of films.","SELECT release_year, COUNT(*) FROM films GROUP BY release_year ORDER BY COUNT(*) DESC LIMIT 1;"
"Calculate the average rating of films released in each year.","SELECT release_year, AVG(rating) FROM films GROUP BY release_year;"
"Find the year with the highest average rating.","SELECT release_year, AVG(rating) FROM films GROUP BY release_year ORDER BY AVG(rating) DESC LIMIT 1;"
"Retrieve the number of films released in the last decade.","SELECT COUNT(*) FROM films WHERE release_year BETWEEN 2014 AND 2024;"
"Calculate the total count of films with non-null ratings.","SELECT COUNT(*) FROM films WHERE rating IS NOT NULL;"
"Retrieve the details of films with a rating higher than the average rating of all films.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films);"
"Retrieve the details of films released after the year of the film with the highest rating.","SELECT * FROM films WHERE release_year > (SELECT release_year FROM films ORDER BY rating DESC LIMIT 1);"
"Retrieve the details of films with a rating higher than the average rating of films released in 2022.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films WHERE release_year = 2022);"
"Retrieve the details of films with a rating higher than the lowest rating of films released in 2022.","SELECT * FROM films WHERE rating > (SELECT MIN(rating) FROM films WHERE release_year = 2022);"
"Retrieve the details of films released in the same year as 'The Matrix'.",SELECT * FROM films WHERE release_year = (SELECT release_year FROM films WHERE film_name = 'The Matrix');"
"Retrieve the details of films with a rating higher than the average rating of films released in the same year as 'The Matrix'.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films WHERE release_year = (SELECT release_year FROM films WHERE film_name = 'The Matrix'));"
"Retrieve the details of films with a rating higher than the average rating of films watched on January 1, 2022.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films WHERE strftime('%Y-%m-%d', watched_time) = '2022-01-01');"
"Retrieve the details of films released in the same year as the film with the lowest rating.","SELECT * FROM films WHERE release_year = (SELECT release_year FROM films WHERE rating = (SELECT MIN(rating) FROM films));"
"Retrieve the details of films with a rating higher than the average rating of films released after 2000.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films WHERE release_year > 2000);"
"Retrieve the details of films with a rating higher than the average rating of films released before 2000.","SELECT * FROM films WHERE rating > (SELECT AVG(rating) FROM films WHERE release_year < 2000);"
"Retrieve the details of films with release years formatted as 'YYYY-MM-DD'.","SELECT film_name, strftime('%Y-%m-%d', release_year) AS formatted_release_year FROM films;"
"Retrieve the details of films with their names converted to uppercase.","SELECT UPPER(film_name) FROM films;"
"Retrieve the details of films with their release years shifted by 5 years into the future.","SELECT film_name, release_year + 5 AS future_release_year FROM films;"
"Retrieve the details of films with their ratings rounded to the nearest integer.","SELECT ROUND(rating) FROM films;"
"Retrieve the details of films with their review lengths calculated.","SELECT film_name, LENGTH(review) AS review_length FROM films;"
"Retrieve the details of films with their review contents replaced with 'No review available' if the review is null.","SELECT film_name, COALESCE(review, 'No review available') AS review_content FROM films;"
"Retrieve the details of films with their ratings multiplied by 2.","SELECT film_name, rating * 2 AS multiplied_rating FROM films;"
"Retrieve the details of films with their release years truncated to the nearest decade.","SELECT film_name, CAST(release_year / 10 * 10 AS INTEGER) AS truncated_release_year FROM films;"
"Retrieve the details of films with their ratings ranked in descending order.","SELECT film_name, rating, RANK() OVER (ORDER BY rating DESC) AS rating_rank FROM films;"
"Retrieve the details of films with their release years converted to Julian day numbers.","SELECT film_name, julianday(release_year) AS julian_release_year FROM films;"
"List films with release years formatted as 'YYYY-MM-DD'.","SELECT film_name, strftime('%Y-%m-%d', release_year) AS formatted_release_year FROM films;"
"Fetch films with their names converted to uppercase.","SELECT UPPER(film_name) FROM films;"
"Retrieve films with release years shifted by 5 years into the future.","SELECT film_name, release_year + 5 AS future_release_year FROM films;"
"Show films with ratings rounded to the nearest integer.","SELECT ROUND(rating) FROM films;"
"Display films with their review lengths calculated.","SELECT film_name, LENGTH(review) AS review_length FROM films;"
"Bring films with review contents replaced with 'No review available' if the review is null.","SELECT film_name, COALESCE(review, 'No review available') AS review_content FROM films;"
"List films with ratings multiplied by 2.","SELECT film_name, rating * 2 AS multiplied_rating FROM films;"
"Fetch films with release years truncated to the nearest decade.","SELECT film_name, CAST(release_year / 10 * 10 AS INTEGER) AS truncated_release_year FROM films;"
"Show films with ratings ranked in descending order.","SELECT film_name, rating, RANK() OVER (ORDER BY rating DESC) AS rating_rank FROM films;"
"Display films with release years converted to Julian day numbers.","SELECT film_name, julianday(release_year) AS julian_release_year FROM films;"
"Find films with the longest review length.","SELECT * FROM films WHERE LENGTH(review) = (SELECT MAX(LENGTH(review)) FROM films);"
"Retrieve films with release years between the earliest and latest years in the database.","SELECT * FROM films WHERE release_year BETWEEN (SELECT MIN(release_year) FROM films) AND (SELECT MAX(release_year) FROM films);"
"List films with release years matching those of the highest-rated films.","SELECT * FROM films WHERE release_year IN (SELECT release_year FROM films WHERE rating = (SELECT MAX(rating) FROM films));"
"Show films with ratings within 1 point of the maximum rating.","SELECT * FROM films WHERE rating >= (SELECT MAX(rating) FROM films) - 1;"
"Retrieve films with ratings at least 1 point lower than the maximum rating.","SELECT * FROM films WHERE rating < (SELECT MAX(rating) FROM films) - 1;"
"Find films with release years matching those of the lowest-rated films.","SELECT * FROM films WHERE release_year IN (SELECT release_year FROM films WHERE rating = (SELECT MIN(rating) FROM films));"
"Display films with release years not found in the list of distinct release years.","SELECT * FROM films WHERE release_year NOT IN (SELECT DISTINCT release_year FROM films);"
"Fetch films with reviews containing words longer than the average word length in reviews.","SELECT * FROM films WHERE LENGTH(SUBSTR(review, INSTR(review || ' ', ' ') + 1)) > (SELECT AVG(LENGTH(SUBSTR(review, INSTR(review || ' ', ' ') + 1))) FROM films);"
"List films with release years that are prime numbers.","SELECT * FROM films WHERE release_year IN (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97);"
"Retrieve films with release years that are leap years.","SELECT * FROM films WHERE release_year % 4 = 0 AND (release_year % 100 != 0 OR release_year % 400 = 0);"
"Find films released in the same year as other films.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.release_year FROM films f1 JOIN films f2 ON f1.release_year = f2.release_year AND f1.id != f2.id;"
"Identify films directed by the same director.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.director FROM films f1 JOIN films f2 ON f1.director = f2.director AND f1.id != f2.id;"
"Discover films with similar genres.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.genre FROM films f1 JOIN films f2 ON f1.genre = f2.genre AND f1.id != f2.id;"
"Retrieve films featuring the same lead actor.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.lead_actor FROM films f1 JOIN films f2 ON f1.lead_actor = f2.lead_actor AND f1.id != f2.id;"
"List films with identical runtime durations.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.runtime FROM films f1 JOIN films f2 ON f1.runtime = f2.runtime AND f1.id != f2.id;"
"Show films in the same language.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.language FROM films f1 JOIN films f2 ON f1.language = f2.language AND f1.id != f2.id;"
"Retrieve films with similar ratings released in the same year.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.release_year FROM films f1 JOIN films f2 ON f1.release_year = f2.release_year AND f1.rating = f2.rating AND f1.id != f2.id;"
"Find films with the same director and runtime difference within 10 minutes.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.director FROM films f1 JOIN films f2 ON f1.director = f2.director AND ABS(f1.runtime - f2.runtime) <= 10 AND f1.id != f2.id;"
"Retrieve films with the same genre and at least 1 year difference in release.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.genre FROM films f1 JOIN films f2 ON f1.genre = f2.genre AND ABS(f1.release_year - f2.release_year) >= 1 AND f1.id != f2.id;"
"Identify films with the same lead actor and within 20 minutes runtime difference.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.lead_actor FROM films f1 JOIN films f2 ON f1.lead_actor = f2.lead_actor AND ABS(f1.runtime - f2.runtime) <= 20 AND f1.id != f2.id;"
"Retrieve films with similar ratings and lead actor but different directors.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.rating, f1.lead_actor FROM films f1 JOIN films f2 ON f1.rating = f2.rating AND f1.lead_actor = f2.lead_actor AND f1.director != f2.director AND f1.id != f2.id;"
"Find films released in the same year with a difference of 20 minutes in runtime.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.release_year FROM films f1 JOIN films f2 ON f1.release_year = f2.release_year AND ABS(f1.runtime - f2.runtime) <= 20 AND f1.id != f2.id;"
"Retrieve films with the same language and runtime difference within 15 minutes.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.language FROM films f1 JOIN films f2 ON f1.language = f2.language AND ABS(f1.runtime - f2.runtime) <= 15 AND f1.id != f2.id;"
"Identify films with the same genre and director but different release years.","SELECT f1.film_name AS film1, f2.film_name AS film2, f1.genre, f1.director FROM films f1 JOIN films f2 ON f1.genre = f2.genre AND f1.director = f2.director AND f1.release_year != f2.release_year AND f1.id != f2.id;"
"Retrieve films where the runtime is within 10 minutes of 100 minutes.","SELECT * FROM films WHERE ABS(runtime - 100) <= 10;"
"Find films with the rating increased by 1.","SELECT film_name, rating + 1 AS increased_rating FROM films;"
"Retrieve films with a review or 'No review available' if the review is null.","SELECT film_name, coalesce(review, 'No review available') AS review_content FROM films;"
"List films with the title and release year concatenated.","SELECT concat(film_name, ' ', release_year) AS film_info FROM films;"
"Fetch films with the title and release year concatenated with '-' as a single string.","SELECT concat_ws('-', film_name, release_year) AS film_info FROM films;"
"Display films with ratings formatted to two decimal places.","SELECT film_name, format(rating, '0.00') AS formatted_rating FROM films;"
"Retrieve films with 'The' in the title using a wildcard search.","SELECT * FROM films WHERE glob(film_name, '*The*');"
"Find films where the release year is represented in hexadecimal.","SELECT film_name, hex(release_year) AS hex_release_year FROM films;"
"Retrieve films with the rating if not null, otherwise display 'N/A'.","SELECT film_name, ifnull(rating, 'N/A') AS rating FROM films;"
"Identify films with a rating greater than 4 as 'High' or 'Low'.","SELECT film_name, iif(rating > 4, 'High', 'Low') AS rating_classification FROM films;"
"Find films with 'Matrix' in the title using a substring search.","SELECT * FROM films WHERE instr(film_name, 'Matrix') > 0;"
"Retrieve the last inserted row ID.","SELECT last_insert_rowid() AS last_row_id;"
"List films with the length of the review.","SELECT film_name, length(review) AS review_length FROM films;"
"Fetch films with titles starting with 'The'.","SELECT * FROM films WHERE film_name like 'The%';"
"Display films with ratings rounded to two decimal places if they exceed 3.","SELECT film_name, round(ifnull(rating, 0), 2) AS formatted_rating FROM films WHERE rating > 3;"
"Retrieve films with leading whitespaces removed from the title.","SELECT ltrim(film_name) AS trimmed_title FROM films;"
"Retrieve films with the review if available, otherwise display 'No review available'.","SELECT film_name, COALESCE(review, 'No review available') AS review_content FROM films;"
"Fetch films with either the director's name or 'Unknown' if the director is null.","SELECT film_name, COALESCE(director, 'Unknown') AS director_name FROM films;"
"Display films with the release year if available, otherwise show 'N/A'.","SELECT film_name, COALESCE(release_year, 'N/A') AS release_year FROM films;"
"List films with either the rating or 'Not rated' if the rating is null.","SELECT film_name, COALESCE(rating, 'Not rated') AS film_rating FROM films;"
"Retrieve films with the lead actor's name if provided, otherwise display 'Unknown'.","SELECT film_name, COALESCE(lead_actor, 'Unknown') AS lead_actor_name FROM films;"
"Find films with the genre if available, otherwise show 'Not specified'.","SELECT film_name, COALESCE(genre, 'Not specified') AS film_genre FROM films;"
"Identify films with the language specified or 'Not specified' if the language is null.","SELECT film_name, COALESCE(language, 'Not specified') AS film_language FROM films;"
"Retrieve films with the runtime duration if provided, otherwise display 'Unknown'.","SELECT film_name, COALESCE(runtime, 'Unknown') AS runtime_duration FROM films;"
"List films with the budget if available, otherwise show 'Not available'.","SELECT film_name, COALESCE(budget, 'Not available') AS film_budget FROM films;"
"Fetch films with the country of production if specified, otherwise display 'Not specified'.","SELECT film_name, COALESCE(country, 'Not specified') AS production_country FROM films;"
"Trim leading and trailing whitespace from the title column.","SELECT trim(title) FROM films;"
"Trim leading and trailing characters 'abc' from the description column.","SELECT trim(description, 'abc') FROM films;"
"Get the data type of the runtime column.","SELECT typeof(runtime) FROM films;"
"Convert hexadecimal string '4D61726B' to its binary value.","SELECT unhex('4D61726B');"
"Convert hexadecimal string '4D61726B' to its binary value and specify the output length as 4.","SELECT unhex('4D61726B', 4);"
"Get the Unicode code point of the first character in the film_name column.","SELECT unicode(film_name) FROM films;"
"Estimate the likelihood of a condition being false.","SELECT unlikely(rating < 3) FROM films;"
"Convert the film_name column to uppercase.","SELECT upper(film_name) FROM films;"
"Generate a zero-filled blob of length 100.","SELECT zeroblob(100);"