8 Bristol-Myers SQL Interview Questions (Updated 2024)

Updated on

October 31, 2024

Bristol-Myers employees write SQL queries to extract and analyze clinical trial data, helping them gain insights that are crucial for drug development research. They also use SQL to manage patient healthcare records, allowing them to track important information that supports their research efforts, for this reason, Bristol-Myers evaluates job seekers with SQL questions during interviews for Data Analytics, Data Science, and Data Engineering roles.

To help you practice for the Bristol-Myers SQL interview, we've collected 8 Bristol-Myers Squibb SQL interview questions in this blog.

Bristol-Myers SQL Interview Questions

8 Bristol-Myers Squibb SQL Interview Questions

SQL Question 1: Average Sales of Top 10 Medicines by Month

Write a SQL query to find the average sales of the top 10 medicines per month from the Bristol-Myers company. The data is given in two tables, one containing the sales data and the other containing the medicine details. You will have to use SQL window functions for this problem.

:

idmedicine_idsales_dateunits_sold
110102/15/2022200
210202/20/2022150
310102/25/2022250
410302/28/2022300
510403/01/2022100
610503/05/2022350
710603/08/2022300
810203/15/2022400
910303/20/2022200
1010103/25/2022500

:

medicine_idmedicine_name
101Opdivo
102Eliquis
103Orencia
104Yervoy
105Reyataz
106Sprycel

Answer:


In this query, first we are calculating the average sales per month for each medicine using a window function. Then we are ranking these medicines based on their average sales using another window function, ROW_NUMBER(), partitioning by month and ordering by average sales in descending order. The final query fetches the top 10 medicines per month based on these rankings. We then join with the medicine table to fetch the medicine name.

Pro Tip: Window functions are a popular SQL interview topic, so practice every window function problem on DataLemur

DataLemur SQL Questions

Discover how Bristol-Myers is unleashing the power of digital technologies to enhance their research and development processes! This knowledge is essential for grasping how digital transformation is shaping the pharmaceutical industry and improving drug discovery.

SQL Question 2: Top 3 Department Salaries

Imagine there was a table of Bristol-Myers employee salary data. Write a SQL query to find the top three highest paid employees in each department.

Bristol-Myers Example Input:

employee_idnamesalarydepartment_id
1Emma Thompson38001
2Daniel Rodriguez22301
3Olivia Smith20001
4Noah Johnson68002
5Sophia Martinez17501
8William Davis68002
10James Anderson40001

Example Input:

department_iddepartment_name
1Data Analytics
2Data Science

Example Output:

department_namenamesalary
Data AnalyticsJames Anderson4000
Data AnalyticsEmma Thompson3800
Data AnalyticsDaniel Rodriguez2230
Data ScienceNoah Johnson6800
Data ScienceWilliam Davis6800

Try this interview question and run your code right in DataLemur's online SQL environment:

Top 3 Department Salaries

Answer:

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 hard to understand, you can find a step-by-step solution here: Top 3 Department Salaries.

SQL Question 3: What are the different kinds of joins in SQL?

A join in SQL allows you to retrieve data from multiple tables and combine it into a single set of results.

In SQL, there are four different types of JOINs. To demonstrate each kind, imagine you had two database tables, an advertising campaigns table which had information on Google Ads keywords and how much was bid for each keyword, and a sales table, which has data on how many products were sold and which Google Ads keyword drove that sale.

: An INNER JOIN retrieves rows from both tables where there is a match in the shared key or keys. For example, an INNER JOIN between the table and the table could be performed using the keyword column as the shared key. This would retrieve only the rows where the keyword in the table matches the keyword in the table.

: A LEFT JOIN retrieves all rows from the left table (in this case, the table) and any matching rows from the right table (the Sales table). If there is no match in the right table, values will be returned for the right table's columns.

: A RIGHT JOIN retrieves all rows from the right table (in this case, the Sales table) and any matching rows from the left table (the table). If there is no match in the left table, values will be returned for the left table's columns.

: A FULL OUTER JOIN retrieves all rows from both tables, regardless of whether there is a match in the shared key or keys. If there is no match, values will be returned for the columns of the non-matching table.

Bristol-Myers Squibb SQL Interview Questions

SQL Question 4: Click-through-rate for Bristol-Myers Drug Campaigns

The marketing team at Bristol-Myers has been running several digital ad campaigns for their different drug products. For each campaign, they've tracked every time an ad was viewed as well as the number of times these views resulted in a click to the company's website.

Your task is to calculate the click-through-rate (CTR) of each campaign. CTR is calculated by the number of clicks divided by the number of views, typically represented as a percentage.

Provide the CTR for each campaign, sorted by the CTR in descending order.

Example Input:

campaign_iddrug
1Opdivo
2Bristol-Myers
3Reyataz

Example Input:

impression_idcampaign_idview_date
4567106/08/2022
5678308/12/2022
6789207/26/2022
7891307/21/2022
8912106/20/2022

Example Input:

click_idimpression_idclick_date
1123456706/08/2022
2234789107/22/2023
3345891206/20/2022
4456456706/09/2022

Answer:


This query first joins the , , and tables together using the appropriate keys. It then counts the number of unique impressions that result in a click, and divides this by the total number of unique ad impressions. Finally, it sorts the results by the CTR in descending order. Since the number of impressions or clicks per campaign could be very large, grouping by the campaign drug is more efficient than grouping by each impression.

To solve a similar problem about calculating rates, try this SQL interview question from TikTok within DataLemur's online SQL coding environment:

SQL interview question from TikTok

SQL Question 5: When would you use the function?

The function allows you to select the first non-NULL value from a list of values. It is often used to replace a NULL value with a default value in order to run aggregate functions like or on a column without being affected by values.

For example, if you conducted a customer satisfaction survey for a company and asked customers to rate their level of agreement with a statement on a scale of 1 to 10, some customers may not have answered all the questions, resulting in NULL values in the survey data:

customer_idquestion_idagree_amount
10119
101210
20216
2022NULL
30314
3032NULL

To replace the NULLs in the column with the default value of 5 which corresponds to neutral on the survey, you could run the following SQL query:


You'd get the following output:

customer_idquestion_idagree_amount
10119
101210
20216
20225
30314
30325

SQL Question 6: Customer and Order Join

You are working as a data analyst at Bristol-Meyers and your task is to write a SQL query to analyze the customer database and join it with the orders database to find out the total amount spent by each customer.

Here are the databases you have to work with:

Example Input:

customer_idfirst_namelast_name
100JohnDoe
101JaneSmith
102TomBrown
103AliceJohnson
104BobMiller

Example Input:

order_idcustomer_idproductquantityprice
50000100Item1220.00
50001101Item2115.00
50002102Item3210.00
50003103Item1120.00
50004104Item2115.00

Answer:


This query first joins the and tables using the column that is common to both tables. Then, for each unique combination of and (i.e., for each customer), it computes the total amount spent by that customer (which is the quantity multiplied by the price for each order that customer has) and returns these results.

Because join questions come up routinely during SQL interviews, practice this interactive Snapchat JOIN SQL interview question:

Snapchat SQL Interview question using JOINS

SQL Question 7: What does the keyword do?

The clause in SQL allows you to select records that are unique, eliminating duplicates.

For example, if you had a table of Bristol-Myers employees, and wanted to see what are all the unique job titles that currently worked at the company, you could write the following query:


SQL Question 8: Calculate the Adjusted Sales and The Growth Rate

Bristol-Myers has a table named , which holds their monthly sales data for their products. The columns are , , , , , and . The shows the fractional discount given on the listed price.

Your task is to calculate the total 'Adjusted Sales' for each product on a monthly basis. 'Adjusted Sales' is calculated as the product's quantity sold multiplied by the unit price after applying the discount ().

You are also required to calculate 'Growth Rate' () on a monthly basis. Remember, if 'Adjusted Sales' for last month is zero or null, 'Growth Rate' should be treated as null.

Example Input:

sale_idproduct_idsale_datequantityunit_pricediscount_rate
34632003403/05/2022100$80.50.05
45622003403/12/202250$80.50.10
69273005403/27/2022200$45.00.20
93452003404/05/202270$80.50.15
28473005404/14/2022150$45.00.10

Answer:


This query first calculates the 'Adjusted Sales' for each month per product. Then it creates another table where the 'Adjusted Sales' of last month are linked to the current month for each product. In the final step, the 'Growth Rate' is calculated using the formula given and the result is returned with each product's 'Adjusted Sales' & 'Growth Rate' on a monthly basis.

To practice a very similar question try this interactive Amazon Highest-Grossing Items Question which is similar for calculating top grossing items or this Wayfair Y-on-Y Growth Rate Question which is similar for calculating growth rates.

Bristol-Myers SQL Interview Tips

The key to acing a Bristol-Myers SQL interview is to practice, practice, and then practice some more! Beyond just solving the above Bristol-Myers SQL interview questions, you should also solve the 200+ SQL coding questions which come from companies like Netflix, Google, and Amazon.

DataLemur SQL and Data Science Interview Questions

Each DataLemur SQL question has multiple hints, detailed solutions and best of all, there's an interactive coding environment so you can instantly run your SQL query and have it graded.

To prep for the Bristol-Myers SQL interview it is also a great idea to solve SQL questions from other healthcare and pharmaceutical companies like:

But if your SQL skills are weak, forget about diving straight into solving questions – improve your SQL foundations with this SQL tutorial for Data Scientists & Analysts.

SQL tutorial for Data Scientists & Analysts

This tutorial covers things like filtering data with WHERE and math functions – both of these come up routinely in Bristol-Myers interviews.

Bristol-Myers Squibb Data Science Interview Tips

What Do Bristol-Myers Data Science Interviews Cover?

Besides SQL interview questions, the other question categories tested in the Bristol-Myers Data Science Interview include:

Bristol-Myers Data Scientist

How To Prepare for Bristol-Myers Data Science Interviews?

To prepare for Bristol-Myers Data Science interviews read the book Ace the Data Science Interview because it's got:

  • 201 interview questions sourced from FAANG tech companies
  • a crash course covering SQL, Product-Sense & ML
  • over 1000+ reviews on Amazon & 4.5-star rating

Ace the Data Science Interview Book on Amazon

Don't forget about the behavioral interview – prepare for it with this guide on behavioral interview questions.

© 2024 DataLemur, Inc

Career Resources

Free 9-Day Data Interview Crash CourseFree SQL Tutorial for Data AnalyticsUltimate SQL Interview GuideAce the Data Job Hunt Video CourseAce the Data Science InterviewBest Books for Data Analysts