Filtering a DB using SQL Queries
While practicing SQL, I worked on a movie rental database and tried solving different types of queries using conditions, sorting,limits and pattern matching. 1.Movies with rental rate > $3 SELEC...

Source: DEV Community
While practicing SQL, I worked on a movie rental database and tried solving different types of queries using conditions, sorting,limits and pattern matching. 1.Movies with rental rate > $3 SELECT * FROM film WHERE rental_rate > 3; 2.Rental rate > $3 AND replacement cost < $20 SELECT * FROM film WHERE rental_rate > 3 AND replacement_cost < 20; 3.Movies rated 'PG' OR rental rate = $0.99 SELECT * FROM film WHERE rating = 'PG' OR rental_rate = 0.99; 4.Top 10 movies by highest rental rate SELECT * FROM film ORDER BY rental_rate DESC LIMIT 10; 5.Skip first 5, fetch next 3 (ascending rental rate) SELECT * FROM film ORDER BY rental_rate ASC LIMIT 3 OFFSET 5; 6.First 5 movies sorted by title SELECT * FROM film ORDER BY title ASC LIMIT 5; 7.Skip first 10, fetch next 3 (highest replacement cost) SELECT * FROM film ORDER BY replacement_cost DESC LIMIT 3 OFFSET 10; 8.Top 5 movies with highest replacement cost (skip most expensive) SELECT * FROM film ORDER BY replacement_cost DESC