
DB-TASK-001
I was practicing some SELECT queries in the dvdrental database to understand sorting, alias, unique values and ordering. I tried different queries and below are the ones I used and why I used them. First I tried to retrieve film titles and rental rate but I renamed the column names so it looks better while reading. SELECT title AS "Movie Title" , rental_rate AS "Rate" FROM film ; I used this because alias makes output more readable instead of database column names. Then I listed customer names and emails with alias. SELECT first_name AS "First Name" , last_name AS "Last Name" , email FROM customer ; I used this to see customer contact details in a proper format. Then I sorted films by rental rate descending and if same rate then by title. SELECT title , rental_rate FROM film ORDER BY rental_rate DESC , title ASC ; I used this to see costly rental movies first and sort same price movies alphabetically. Then I sorted actor names. SELECT first_name , last_name FROM actor ORDER BY last_nam
Continue reading on Dev.to Beginners
Opens in a new tab




