-
The purpose of accepting this challenge is to dive deep in Querying concepts starting from basic SQL problem solving to performance tuning, query optimization etc.,
-
This repository would contain the
Python
way of solving the problems.
Problem statement:
Write a query that calculates the difference between the highest salaries found in the marketing and engineering departments. Output just the difference in salaries.
Data Structure: view here
Datasets: view here
Solution1: view here
Problem statement:
Find the date with the highest total energy consumption from the data centers. Output the date along with the total energy consumption across all data centers.
Data model: view here
Datasets view here
Solution: view here
Problem statement: Find the total number of downloads for paying and non-paying users by date. Include only records where non-paying customers have more downloads than paying customers. The output should be sorted by earliest date first and contain 3 columns date, non-paying downloads, paying downloads.
Datasets: view here
Solution: view here
Problem statement: Find the popularity percentage for each user on Facebook. The popularity percentage is defined as the total number of friends the user has divided by the total number of users on the platform, then converted into a percentage by multiplying by 100. Output each user along with their popularity percentage. Order records in ascending order by user id. The 'user1' and 'user2' column are pairs of friends.
Datasets: view here
Solution: view here
Problem statement: Write a query that'll identify returning active users. A returning active user is a user that has made a second purchase within 7 days of any other of their purchases. Output a list of user_ids of these returning active users.
Datasets: view here
Solution: view here
Problem statement: view here
Solution: view here