At Oliver Wyman, SQL is essential for extracting and analyzing client data on market trends and customer behavior, which supports their consulting projects. It is also used to manage internal data on project timelines and resource allocation to improve operational efficiency, which is why Oliver Wyman includes SQL questions in interviews for Data Analytics, Data Science, and Data Engineering roles.
Thus, to help you prep for the Oliver Wyman SQL interview, here’s 10 Oliver Wyman SQL interview questions – scroll down to start solving them!
Given a database of transactions at the consulting firm, Oliver Wyman, write a SQL query to identify the VIP clients. These are the clients that have expenditure exceeding $100,000 over the last quarter (three months).
Assuming we have a 'transactions' table with the following schema:
transaction_id | client_id | transaction_date | amount |
---|---|---|---|
126 | 45 | 01/01/2022 | 10000 |
278 | 32 | 01/10/2022 | 25000 |
974 | 45 | 02/05/2022 | 35000 |
114 | 23 | 02/28/2022 | 20000 |
213 | 45 | 03/12/2022 | 55000 |
This query first filters out transactions that happened in the last quarter. Then it groups transactions by client_id, calculates the total amount spent by each client, and finally filters out those who have expenditure exceeding $100,000. The result will be a list of VIP clients and their corresponding total expenditure in the last quarter.
To practice a related customer analytics question on DataLemur's free online SQL code editor, try this Microsoft Azure Cloud SQL Interview Question:
Imagine you had a table of Oliver Wyman employee salary data. Write a SQL query to find the top 3 highest paid employees within each department.
employee_id | name | salary | department_id |
---|---|---|---|
1 | Emma Thompson | 3800 | 1 |
2 | Daniel Rodriguez | 2230 | 1 |
3 | Olivia Smith | 2000 | 1 |
4 | Noah Johnson | 6800 | 2 |
5 | Sophia Martinez | 1750 | 1 |
8 | William Davis | 6800 | 2 |
10 | James Anderson | 4000 | 1 |
department_id | department_name |
---|---|
1 | Data Analytics |
2 | Data Science |
department_name | name | salary |
---|---|---|
Data Analytics | James Anderson | 4000 |
Data Analytics | Emma Thompson | 3800 |
Data Analytics | Daniel Rodriguez | 2230 |
Data Science | Noah Johnson | 6800 |
Data Science | William Davis | 6800 |
Try this problem and run your code right in DataLemur's online SQL environment:
We use the DENSE_RANK() window function to generate unique ranks for each employee's salary within their department, with higher salaries receiving lower ranks. Then, we wrap this up in a CTE and filter the employees with a ranking of 3 or lower.
If the solution above is tough, you can find a detailed solution with hints here: Top 3 Department Salaries.
Database denormalization is when you add redundancy to a database, and break typical normalization rules (codified by the 1st, 2nd, 3rd normal forms).
Denormalization is typically used to improve the performance of a database, particularly when the database is being for OLAP (Online Analytical Processing) purposes. By denormalizing a database, you can reduce the number of joins that are required to retrieve data, which can greatly improve the speed of queries since joins are costly and slow. However, denormalization can also introduce some problems, such as increased data redundancy and the need for more complex update and delete operations since data has been duplicated into multiple tables.
In general, denormalization should be used with caution and only after careful consideration of the trade-offs involved. It's typically better to start with a well-normalized database design then denormalize only if your database isn't scaling as well as you want.
Oliver Wyman is a management consulting firm. Let's say they want to analyze the billing information for their consultants. They are interested in the Quarterly Average Revenue per Consultant.
For this analysis, they have a database table named "billings" in the following format:
billing_id | consultant_id | client_id | billing_date | revenue |
---|---|---|---|---|
101 | 1 | 1001 | 2022-01-10 | 5000 |
102 | 1 | 1002 | 2022-01-30 | 7000 |
103 | 2 | 1001 | 2022-02-15 | 6000 |
104 | 1 | 1003 | 2022-04-20 | 8000 |
105 | 2 | 1003 | 2022-06-30 | 9000 |
106 | 3 | 1002 | 2022-07-01 | 4000 |
107 | 2 | 1004 | 2022-09-15 | 7500 |
108 | 3 | 1001 | 2022-10-15 | 6500 |
The question: Write a SQL query that calculates the mean revenue per consultant for each quarter of the year.
Year | Quarter | consultant_id | Average_Revenue |
---|---|---|---|
2022 | Q1 | 1 | 6000.00 |
2022 | Q1 | 2 | 6000.00 |
2022 | Q2 | 1 | 8000.00 |
2022 | Q2 | 2 | 9000.00 |
2022 | Q3 | 2 | 7500.00 |
2022 | Q3 | 3 | 4000.00 |
2022 | Q4 | 3 | 6500.00 |
In this query, we use the function to calculate the average revenue per consultant for each quarter. The function is used to get the year and quarter from the billing_date. Then we group by year, quarter, and consultant id to get the result.
Please note, the function extracts the quarter of the year (a number from 1 to 4) from . We concatenate 'Q' with the extracted quarter number using operator to get the output in 'Q1', 'Q2', 'Q3', 'Q4' format.
p.s. Window functions show up pretty often during SQL interviews, so practice the 27+ window function questions on DataLemur
There's several steps you can take to troubleshoot a slow SQL query.
First things first, figure out why the query is slow! You can use and commands in PostgreSQL to identify any performance bottlenecks. After that, you can start changing your query, depending on what the source of the query performance issue is.
Generally, indexes can help speed up queries. Also de-normalizing your tables might help, to remove slow joins.
Lastly, you could always just upgrade your hardware! Time and money wasted improving query performance could just be better spent on mroe powerful database servers!
While this is a very surface-level approach to optimizing SQL query performance, it should do the trick for Data Analyst interviews and Data Science interviews at Oliver Wyman. Data Engineers should know a bit more about the and before the interview.
Suppose you are working as a data analyst at Oliver Wyman. You have access to the customer records for an online store. The dataset includes customer details such as customer IDs, location, date of registration, product preferences, and the total amount of purchases made.
Your manager wants you to filter the data for customers who are from 'New York', registered after 'January 1, 2020', prefer 'Electronics' products, and have made purchases exceeding $5000. Write an SQL query to extract this information.
Here is some sample data for this task:
customer_id | location | registration_date | product_preference | total_purchase |
---|---|---|---|---|
101 | New York | 2020-01-15 | Electronics | 8000 |
102 | Chicago | 2020-02-20 | Books | 3000 |
103 | New York | 2019-12-27 | Electronics | 6000 |
104 | San Francisco | 2020-03-14 | Books | 4000 |
105 | New York | 2020-04-01 | Electronics | 7800 |
This query starts by selecting all records from the table. Then it filters the records based on four conditions using the clause along with the logical operators . The conditions mentioned check whether the location is 'New York', the registration date is after '2020-01-01', the product preference is 'Electronics', and the total purchase exceeds $5000. The result set will include all records that meet all these criteria.
The UNION operator combines the results from multiple SELECT statements into a single result set.
Here's an example of using the UNION operator to combine the results of two SELECT statements that retrieve data from tables of Oliver Wyman's Facebook ads and their Google ads:
This statement would return a combined result set of both Facebook and Google ads that have a spend greater than $200. The result set would include the following columns: ad_id, ad_name, ad_type, impressions, clicks, and spend.
Note that the two SELECT statements within the UNION must have the same number of columns and the columns must have similar data types. In this example, both SELECT statements have the same number of columns and the data types of the columns are all compatible.
As an analyst at Oliver Wyman, your tasks often include evaluating the performance of ongoing consulting projects. You are given the task to find the average client satisfaction score of consulting projects. Satisfactions scores are based on feedback given by clients post-consultation, and they range from 1 (very dissatisfied) to 5 (very satisfied).
project_id | client_id | start_date | end_date |
---|---|---|---|
101 | 1201 | 01/01/2022 | 01/31/2022 |
102 | 1505 | 02/10/2022 | 03/05/2022 |
103 | 1201 | 03/15/2022 | 05/15/2022 |
104 | 1505 | 06/20/2022 | 07/20/2022 |
105 | 1782 | 04/01/2022 | 05/01/2022 |
feedback_id | project_id | client_id | date | satisfaction_score |
---|---|---|---|---|
201 | 101 | 1201 | 02/01/2022 | 4 |
202 | 102 | 1505 | 03/06/2022 | 3 |
203 | 103 | 1201 | 05/16/2022 | 2 |
204 | 104 | 1505 | 07/21/2022 | 5 |
205 | 105 | 1782 | 05/02/2022 | 5 |
This query calculates the average satisfaction score across all client feedback. By running this query, we get the average client satisfaction score across all projects. It doesn't require a GROUP BY statement because we want the average across all feedback, not broken down by project or client. The AVG() function in SQL calculates the mean of a set of values, and in this case, we are applying it to the column of the table.
To practice a very similar question try this interactive Amazon Average Review Ratings Question which is similar for requiring calculation of averages or this Alibaba Compressed Mean Question which is similar for requiring calculation of means.
Oliver Wyman is a company that sells a variety of digital consulting products. You are provided with two tables - , that gives you the number of users who clicked on various product advertisements, and , that shows the number of users who after clicking, added the product to their cart.
Calculate the click-through conversion rate for each product, defined as the number of actions divided by the number of , for the month of June 2022.
click_id | user_id | click_date | product_id |
---|---|---|---|
101 | 123 | 06/08/2022 00:00:00 | 50001 |
201 | 265 | 06/10/2022 00:00:00 | 69852 |
301 | 362 | 06/18/2022 00:00:00 | 50001 |
401 | 192 | 07/26/2022 00:00:00 | 69852 |
501 | 981 | 07/05/2022 00:00:00 | 69852 |
add_id | user_id | add_date | product_id |
---|---|---|---|
101 | 123 | 06/08/2022 00:00:00 | 50001 |
201 | 265 | 06/10/2022 00:00:00 | 69852 |
301 | 981 | 07/05/2022 00:00:00 | 69852 |
The above SQL query first joins the and tables on and (using a left join to retain all records in the table) and restricts the results to the month of June 2022. It then calculates the click-through conversion rate by dividing the count of actions by the count of for each product. The multiplication by 1.0 is used to ensure that the calculation returns a floating point result.
To practice a related SQL interview question on DataLemur's free online SQL code editor, try this Facebook SQL Interview question:
Both clustered and non-clustered indexes are used to improve query performance, but they have different characteristics.
A clustered index determines the physical order of the data rows in a table, while a non-clustered index does not. This means that a table can have only one clustered index, but it can have multiple non-clustered indexes.
In terms of query performance, a clustered index is usually faster for searches that return a large number of records, while a non-clustered index is faster for searches that return a small number of records. However, updates to a clustered index are slower, as they require the data rows to be physically rearranged, while updates to a non-clustered index are faster, as they only require the index data structure to be updated.
The best way to prepare for a Oliver Wyman SQL interview is to practice, practice, practice. Beyond just solving the above Oliver Wyman SQL interview questions, you should also solve the 200+ FAANG SQL Questions on DataLemur which come from companies like Microsoft, Google, Amazon, and tech startups.
Each interview question has multiple hints, fully explained answers along with a discussion board to see how others solved it and crucially, there is an interactive coding environment so you can easily right in the browser your query and have it graded.
To prep for the Oliver Wyman SQL interview you can also be helpful to practice interview questions from other management consulting companies like:
However, if your SQL skills are weak, forget about jumping right into solving questions – refresh your SQL knowledge with this free SQL for Data Analytics course.
This tutorial covers SQL concepts such as sorting data with ORDER BY and aggregate window functions – both of which show up frequently in SQL interviews at Oliver Wyman.
Besides SQL interview questions, the other types of questions to prepare for the Oliver Wyman Data Science Interview are:
Discover how Oliver Wyman is harnessing the potential of AI and Data Analytics to drive business success!
To prepare for Oliver Wyman Data Science interviews read the book Ace the Data Science Interview because it's got:
Also focus on the behavioral interview – prep for it with this guide on acing behavioral interviews.