Real Meta SQL interview experience|I thought it was a basic question, but the last question completely disrupted the rhythm

110 Views
No Comment

Recently, I am preparing for a data position in North America and have successively participated in data-related interviews with many major companies, covering DA/DS and other directions. This time Meta The SQL interview is highly representative in its overall structure and examination methods: unified business background, continuous multiple questions. Rather than simply examining SQL syntax proficiency, this round focuses more on the assessment of business abstraction capabilities and data analysis ideas.

Interview overview

  • Company:Meta
  • Post: Data-related positions (biased towards DA/DS)
  • Form:Online video interview
  • Language:Chinese
  • Duration: Approx. 35 minutes
  • Content:
    • SQL multiple questions
    • Unified business scenario (Shop Visibility)
    • Partial indicator design in the second half + SQL implementation
meta sql interview

Meta SQL classic test questions sharing

Question1: Users with Many Searches

Question difficulty: easy

Count the number of users who made more than 5 searches in August 2021.

Table structure: fb_searches

Field name Type
Age_group Text
Date Date
search_id bigint
search_query Text
User_id bigint

Problem solving ideas

sql

SELECT count(user_id) AS result
FROM
  (SELECT user_id,
          count(search_id) AS august_searches
   FROM fb_searches
   WHERE date BETWEEN '2021-08-01' AND '2021-08-31'
   GROUP BY user_id) a
WHERE august_searches > 5

Question2: Number of Conversations

Question difficulty: Medium

Count the total number of distinct conversations on WhatsApp. Two users share a conversation if there is at least 1 message between them.

Multiple messages between the same pair of users are considered a single conversation.

Message_date

Field name Type
Message_date Date
Message_id bigint
Message_receiver_id Text
message_sender_id Text
message_time Text

Problem solving ideas

WITH all_conversation_combinations AS
  (SELECT message_sender_id AS user1,
          message_receiver_id AS user2
   FROM whatsapp_messages
   UNION SELECT message_receiver_id AS user1,
                message_sender_id AS user2
   FROM whatsapp_messages)
SELECT COUNT(*) AS number_of_conversations
FROM all_conversation_combinations
WHERE user1 < user2

Question3:

Question difficulty: Hard

Meta/Facebook’s web logs capture every action from users starting from page loading to page scrolling.

Find the user with the least amount of time between a page load and their scroll down.

Your output should include the user id, page load time, scroll down time, and time between the two events in seconds.

Table structure: facebook_web_log

Field name Type
Action Text
Timestamp Timestamp without time zone
User_id bigint

Problem solving ideas

WITH cte AS
  (SELECT user_id,
          load_time,
          scroll_time,
          duration::TIME AS duration
   FROM
     (SELECT t1.user_id,
             t1.timestamp AS load_time,
             t2.timestamp AS scroll_time,
             t2.timestamp - t1.timestamp duration
      FROM facebook_web_log t1
      JOIN facebook_web_log t2 ON t1.user_id = t2.user_id
      WHERE t1.action = 'page_load'
        AND t2.action = 'scroll_down'
        AND t2.timestamp > t1.timestamp )sq
  ),
     rank_cte AS
  (SELECT *,
          rank() OVER (ORDER BY duration) AS rnk
   FROM cte)
SELECT user_id,
       load_time,
       scroll_time,
       duration
FROM rank_cte
WHERE rnk = 1

Why do I look for Programhelp in advance this round?

In fact, before preparing for this round of Meta, I have clearly felt a change: the data position/SQL interviews at major North American companies are becoming more and more like "real-time games" rather than static questions. Many questions are not difficult in themselves, but they will be constantly asked and the conditions will be constantly tightened. If the current thinking goes astray, it is easy to get lost in the interview. In this case, relying solely on AI or post-mortem review is of very limited help. It was also at this stage that I came into contact with Programhelp Interview assistance , and finally successfully got the offer.

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END
 0