3 Apple SQL Interview Questions To Practice (From Recent Apple Technical Interviews)
DataLemur ?? (Ace the SQL & Data Interview)
Practice 200+ FAANG SQL & Data Interview questions! Made by Nick Singh (Ex-FB & Author of Ace the Data Interview ??)
If you've got an upcoming SQL interview at Apple, as part of a Data Science, Data Analyst, or Data Engineering job interview at Apple, you've got to practice these 3 real Apple SQL Interview Questions!
SQL Question 1: AirPod Percentage After Buying iPhone
Write a SQL query to determine the percentage of buyers who bought AirPods directly after they bought iPhones.
In the example above, we output 50% because only user 101 bought AirPods after buying an iPhone. We can't count customer 301 since they bought an iPad in between their iPhone and AirPods.
To practice this question yourself, subscribe to DataLemur Premium and start solving this problem directly in the browser:
Solution:
WITH cte AS (
SELECT
customer_id,
STRING_AGG(product_name, ',' ORDER BY transaction_timestamp) AS products
FROM transactions
GROUP BY 1
)
SELECT
ROUND(100.0 * SUM(CASE WHEN products LIKE '%iPhone,AirPods%' THEN 1 END) / COUNT(DISTINCT customer_id), 0) AS follow_up_percentage
FROM transactions
JOIN cte
USING(customer_id)
SQL Question 2: Difference Between WHERE vs. HAVING?
This is an easy Apple SQL Interview question, meant for Business Analysts and interns. HAVING is similar to WHERE, except it's used to filter groups of rows (that are the result of the GROUP BY) clause.
领英推荐
Here's a great infographic to help:
SQL Question 3: Apple Device Trade-In Analysis
Apple has a trade-in program where their customers can return the old iPhone device to Apple and Apple gives the customers the trade-in value (known as payout) of the device in cash.
For each store, write a SQL query of the total revenue from the trade-in. Order the result by the descending order.
Want to practice more Apple SQL Interview Questions?
You'll find more Apple SQL interview questions on DataLemur's blog post 10 Apple SQL Interview Questions which is a MUST READ in case you've got an upcoming Data Science/Data Engineering interview at Apple.
It can also look at Facebook SQL Questions & Amazon SQL Interview Questions for additional practice, because let's face it – FAANG does technical interviews in a similar-ish way!
DATA
1 年Nick Singh ???? m counting this time to get lucky ..........DataLemur ?? (Ace the SQL & Data Interview)
Partner |?Data Scientist
1 年Nick Singh ???? Wow, your website rocks. Your SQL explanations are amazing!
Great Apple SQL questions!
Founder of DataLemur.com (Ace SQL Interviews) ? Best-Selling Author of Ace the Data Science Interview ? Ex-Facebook ? LinkedIn Top Voice ? 175,000+ Nerds Follow Me on LinkedIn for Data/SQL/Career tips!
1 年tricky Apple SQL Interview Questions on this one!