Write an SQL query to retrieve the top 5 highest salaries from the employees
table. The table has the following columns: employee_id
, name
, and salary
.
Please sign-in to view the solution
Write an SQL query to find the average salary of employees in each department from a table employees
with columns department_id
, employee_id
, and salary
.
Please sign-in to view the solution
Write an SQL query to find all email addresses that appear more than once in a users
table with an email
column.
Please sign-in to view the solution
Write an SQL query to identify customers who have placed orders in multiple years. The orders
table has columns order_id
, customer_id
, and order_date
.
Please sign-in to view the solution
You are given two tables: gift_cards
and transactions
. The gift_cards
table has columns card_id
, issued_date
, and initial_balance
. The transactions
table has columns transaction_id
, card_id
, transaction_date
, and amount
. Write an SQL query to calculate the remaining balance on each gift card as of the current date.
Please sign-in to view the solution
As part of a hypothetical gift card program, you are asked to analyze the performance of the program. Key metrics to calculate include:
- Total number of gift cards issued
- Total value of gift cards issued
- Total value of transactions
- Average remaining balance per gift card Provide SQL queries for each metric.
Please sign-in to view the solution
You are tasked with designing an A/B test to evaluate whether hiring linguists to produce subtitles for shows increases user engagement. Describe the steps you would take to design and implement this A/B test, including how you would measure success.
Please sign-in to view the solution
Design a set of metrics to evaluate the effectiveness of hiring linguists to produce subtitles for Netflix shows. Explain why each metric is important and how it would be measured.
Please sign-in to view the solution
Given a table events
with columns event_id
, user_id
, event_type
, and event_time
, write an SQL query to find the time difference between two specific types of events for each user. For example, calculate the time difference between 'login' and 'logout' events for each user.
Please sign-in to view the solution