Answering Business Questions with the Select Query
In this lesson you will use the select query to answer business questions and analyze data
Concepts used in this lesson include:
Data analysis – The ability to review data and make interpretations
Business questions – Questions that can be answered with data
Data Verification – The ability to verify data
SQL functions – Functions that can be used in the select statement
Count function – Counts the number of rows in a table
Sum function – Sums the values in a column
Average function – Calculates the average of a column
Min function – Finds the minimum value in a column
Max function – Finds the maximum value in a column
Distinct function – Returns only unique values in a column
Group by function – Groups data by a column
Order by function – Sorts data by a column
Desc – Sorts data in descending order
Asc – Sorts data in ascending order, this is the default behavior
Limit function – Limits the number of rows returned
Where clause – Filters data
Inner join – Joins two tables based on a join condition
Question asked in this lesson include:
— Retrieve all customer names and their email addresses.
— List the titles and rental rates of all films.
— Count the number of films in the inventory.
— Find the total amount spent by a specific customer (e.g., customer with ID 1).
— Retrieve the names of customers who have rented a film in the last 30 days.
— List the top 5 most rented films.
— Find the average rental duration for all films.
— Retrieve the films that are available for rent.
— Get the total revenue generated by each store.
— List customers who have not made any payments.