Strip Interview Question for Data Engineers

Country: United States
Interview Type: Phone Interview

Comment hidden because of low score. Click to expand.
of 0 vote

with disp_rec as(
        select ds.*, 
               row_number()over(order by dispute_id) as row
          from dispute_records ds
     disp_rec_2 as(
        select d1.*,
	           isnull(d2.created, current_timestamp) as end_date
          from disp_rec d1 left join disp_rec d2 on d1.row=d2.row-1
   select rep.charge_id, 
          count(distinct rep.dispute_id) as cnt_dispute,
	      count(rep.evidence_id) as cnt_evidence,
	      min(rep.is_evidence* as win
	from (
	   select ch.*,
		      disp_rec_2.created as beg_date,
		      es.created as evidence_date,
		      datediff(day, disp_rec_2.created, isnull(es.created, current_timestamp)) diff,
		      case when datediff(day, disp_rec_2.created, isnull(es.created, current_timestamp)) < 31 then 1 else 0 end as win,
		      case when es.evidence_id is null then 0 else 1 end is_evidence
         from charges ch inner join disp_rec_2 on ch.charge_id=disp_rec_2.charge_id
		                 left join evidence_submission es on ch.charge_id=es.charge_id
		                                                 and disp_rec_2.created <= es.created
										                 and disp_rec_2.end_date > es.created
													 ) rep
   group by rep.charge_id, rep.created, rep.amount, rep.seller_id, rep.customer_id

- jk June 29, 2019 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More