
Filter in DB
1.SELECT is used to choose what data to display. 2.WHERE is used to filter records based on conditions. 3.AND and OR are used to combine multiple conditions. 4.ORDER BY is used to sort the data either ascending or descending. 5.LIMIT is used to restrict how many rows are shown. 6.OFFSET is used to skip a certain number of rows. 7.BETWEEN is used to filter values within a range. 8.IN is used to match multiple possible values. 9.LIKE and SIMILAR TO are used for pattern matching in text. 10.IS NULL is used to find missing or empty values. 1. Get movies with rental rate greater than 3 SELECT title, rental_rate FROM film WHERE rental_rate > 3; 2. Rental rate > 3 and replacement cost < 20 SELECT title, rental_rate, replacement_cost FROM film WHERE rental_rate > 3 AND replacement_cost < 20; 3. Rated PG or rental rate 0.99 SELECT title, rating, rental_rate FROM film WHERE rating = 'PG' OR rental_rate = 0.99; 4. Top 10 movies by rental rate SELECT title, rental_rate FROM film ORDER BY rental_ra
Continue reading on Dev.to
Opens in a new tab




