CA 32 - Filter Assignments

 

DB-TASK-002



1. Get all movies (films) that have a rental rate greater than $3.


2. Get all movies that have a rental rate greater than $3 and a replacement cost less than $20.


3.
Get all movies that are either rated as 'PG' or have a rental rate of $0.99.


4.
Show the first 10 movies sorted by rental rate (highest first).


5. Skip the first 5 movies and fetch the next 3 sorted by rental rate in ascending order.


6.
Skip the first 5 movies and fetch the next 3 sorted by rental rate in ascending order.


7.
Get all movies with a rental duration between 3 and 7 days.


8.
Get all movies where the title starts with 'A' and ends with 'e'


9.
Find all customers who do not have an email address listed.


10.
Find all movies released in 2006 with a rental rate of $2.99 or $3.99, and their title starts with 'S'. Display the top 5 results.SELECT title, rental_rate, release_year

    
dvdrental=# SELECT title,rental_rate,release_year FROM film WHERE release_year = 2006 AND rental_Rate = 2.99 OR rental_Rate = 3.99 AND title LIKE 'S%' LIMIT 10;


    Here the title conditional also came under the OR statement and the query turned out to be (release AND rate (2.99)) OR (rate (3.99 AND title ) so even though the whole second part becomes wrong the record is still printed , but we don't need this. SO we place IN instead of the OR .





11. Display 10 customers after skipping the first 20, sorted alphabetically by last name.


12.
Get the top 5 movies with the highest replacement cost, skipping the most expensive one.


13.
Find all rentals that occurred between '2005-05-01' and '2005-06-01'.


14.
Get all actors whose last names contain the letters "man".


15.
Find all movies where the special features are not listed (i.e., special_features is NULL).


16.
Find all movies where the rental duration is more than 7 days.



17.
Find the first 10 movies with a rental rate of $2.99 or $4.99, a rating of 'R', and a title containing the word "L".


18.
Find all movies where the title starts with "A" or "B" and ends with "s".


19.
Find all movies where the title contains "Man", "Men", or "Woman".





Comments

Popular posts from this blog

CA 04 - Two Sum & Sorted Two Sum

CA 05 - Reverse the array

CA 21 - Basic Select SQL Queries