Showing posts with label sql. Show all posts
Showing posts with label sql. Show all posts

Mastercard Data Scientist Interview Questions




In this post, I'm going to share the interview experience for a data scientist position at Mastercard. Overall, the overall process is quite fast and efficient. 

Human Resource 

First, there was no HR round, and an HR communicated with me directly via email asking relevant questions such as:

  • Current base salary and other perks
  • Notification period
  • Expected salary 
  • Hybrid arrangement and if I'm OK with that 
  • ...

Technical Round

Then the HR scheduled the first round, which is a 1 hour session with three people for checking technical skills. There was no pair-coding session, and it was mainly organized as a set of questions from each of the three interviewers. 
  • Asked simple SQL and python questions and to talk about the solutions
  • Questions regarding ML basics
  • Tech stack match between the post and my experience
  • ...
After a few days, I got a call from the HR and checked my availability and fixed the interview time of the next round. It seems their internal process is quite fast.

Hiring manager round

The second (and final) round is a 45 minute session with the hiring manager and one principle individual contributor (IC). Overall, they would like to know if I could jump into the role to execute the new upcoming project.

  • Details about current role
  • Experience of leading (how many) people 
  • Practical experience of deploying ML in real-world settings
  • The scale of previous projects (e.g., how many end users, data scale)
  • How you would like to start structure the ML project?
  • What is the north star and how did you deliver?
  • ...

The final notification regarding the decision was also out quite quickly, on weekend as I recall. 

Overall, the interview process of Mastercard is quite efficient and fast, and jump directly into tech details and testing match between the post and candidate. I hope this post is helpful for you in case you are preparing a similar position for Mastercard. 

How to change string to DATETIME in SQL?


SET `time_str` = STR_TO_DATE(`time_str`,'%d/%m/%Y %H:%i')

What does the numbers in the SQL clause “GROUP BY 1” mean?


SELECT account_id, open_emp_id
         ^^^^        ^^^^
          1           2

FROM account
GROUP BY 1;

GROUP BY 1 refers to the first column in select statement which is account_id.

SQL 자주 쓰는 쿼리

  • Table RandomSample20ForEachPR에서 TUIMSimPrecision이라는 Column 삭제 
 ALTER TABLE aboutme.RandomSample20ForEachPR DROP COLUMN TUIMSimPrecision  
  • Table RandomSample의 TopicCount라는 Column을 TestFlag로 이름 변경
 ALTER TABLE aboutme.RandomSample CHANGE TopicCount TestFlag INT  
  • Table RandomSample20ForEach의 MUIMSim이라는 Column의 데이터속성 변경 
 ALTER TABLE aboutme.RandomSample20ForEach MODIFY COLUMN MUIMSim decimal(12,10)  
  • SUM() and LIMIT  같이 쓸때
 SELECT SUM(SampleFlag) FROM   
      (SELECT SampleFlag FROM aboutme.RandomSample20ForEach WHERE TwitterURI = 'http://www.twitter.com/parklize' ORDER BY TUIMSim DESC LIMIT 10)   
      AS SuccessRate  

  • INSERT INTO... SELECT FROM
 INSERT INTO table2  
 (column_name(s))  
 SELECT column_name(s)  
 FROM table1;  
  • Subquery  limit 문구넣고 실행
 INSERT INTO aboutme.RandomSample50 (TwitterURI, LINK, TopicCount, CreateTime, TestFlag)   
 SELECT TwitterURI, LINK, TopicCount, CreateTime, 1 FROM aboutme.RandomSample  
 WHERE PositiveTestCases = '1' AND TwitterURI IN  
 (SELECT * FROM (SELECT DISTINCT TwitterURI FROM aboutme.RandomSample ORDER BY RAND() LIMIT 50) temp);  
  • Substring
SELECT SUBSTRING_INDEX(UGCID2, '/', -1) FROM UGCListFor150URL  
http://www.twitter.com/parklize/status/562289797117800448->562289797117800448
  • MAMP 에서 MySQL접속 및 sql 파일 실행하기
 
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot  

MySql접속후 아래 명령으로 .sql파일 실행시킨다.

 mysql> source file_name  
 mysql> \. file_name  

  • 현재 connection수 확인하고 kill하기
 SHOW STATUS WHERE `variable_name` = 'Threads_connected';  
 SHOW PROCESSLIST;  
 KILL 9690; // use id to kill the process  

  • Get all "KILL" command for ending all processes over 200 secs.

 select concat('KILL ',id,';') from information_schema.processlist  
 where user='root' and time > 200;  


  • update from select
 update RandomSampleUIM uim, (select distinct Topic, BabelID from _RandomSampleUIM) olduim set uim.`BabelID` = olduim.`BabelID` where uim.`Topic` = olduim.`Topic`;  


  • my.conf 설정 (/etc/mysql/my.conf)
    • max_connections: 연결가능한 connections 수를 설정
  • Ubuntu MySQL start/stop
    • /etc/init.d/mysql start/stop/restart