DEV Community

Santhosh V
Santhosh V

Posted on

CA 31 - Select Queries from DVD Rental database

Today I practiced some basic SQL queries using the DVD Rental database. It helped me understand how to get data from tables in different ways.

First, I learned how to select specific columns and also rename them using aliases. For example, showing movie titles and rental rates with better names.

Then I worked with sorting data using ORDER BY. I sorted films by rental rate, actors by name, and customers in different ways (ascending and descending).

Next, I used DISTINCT to get unique values, like different ratings, rental durations, and replacement costs.

I also tried filtering and limiting results, like getting the top 5 customers or the 10 shortest movies.

One important thing I learned was using GROUP BY with functions like MIN() to find things like the earliest rental date for each customer.

I even used JOIN to connect tables, like getting store-wise rental data.

Top comments (0)