
DB-TASK-002
Get all movies that have rental rate greater than 3 SELECT * FROM film WHERE rental_rate > 3; I used this to filter movies which are costly rental movies. Movies rental rate > 3 and replacement cost < 20 SELECT * FROM film WHERE rental_rate > 3 AND replacement_cost < 20; Here I used AND because both condition must be true. Movies rated PG or rental rate 0.99 SELECT * FROM film WHERE rating = 'PG' OR rental_rate = 0.99; I used OR because any one condition is enough. First 10 movies sorted by rental rate highest first SELECT title, rental_rate FROM film ORDER BY rental_rate DESC LIMIT 10; I sorted high price first then limited to 10. Skip first 5 movies and get next 3 sorted by rental rate ascending SELECT title, rental_rate FROM film ORDER BY rental_rate ASC OFFSET 5 LIMIT 3; OFFSET used to skip rows. (same question again so same query) SELECT title, rental_rate FROM film ORDER BY rental_rate ASC OFFSET 5 LIMIT 3; Movies with rental duration between 3 and 7 SELECT title, rental_duration
Continue reading on Dev.to Tutorial
Opens in a new tab




