Data Engineer - SQL Assessment Inference Labs - New
Data Engineer - SQL Assessment Inference Labs - New
Instructions:
Kindly use any method/technique that you find suitable to get to the required results
Write your name and contact no in Solution Sheet so that we can keep a track of your
work.
Question 1:
The students table contains attendance record for students in a particular week (Monday to Saturday with
no holidays in between).
Table structure:
Write a query to identify students (User_ID) who have attended classes for at least 3 consecutive
days(Attendance of 3 or more consecutive days)? Note: Consider only given below Example table to
write your query and not Logic Table.
Logic
For User
1
Date Present
2021-09-06 Yes
2021-09-07 No Attended 4 Consecutive days
2021-09-08 Yes
2021-09-09 Yes
2021-09-10 Yes
2021-09-11 Yes
For User
2
Date Present
2021-09-06 Yes Attended 4 Consecutive days
2021-09-07 Yes
2021-09-08 Yes
2021-09-09 Yes
2021-09-10 No
Example Table: (You may use this table 2021-09-11 No
to test your query)
For User
Date User_ID Present 3
2021-09-06 User_01 Yes
Date Present
2021-09-06 User_02 Yes Attended 3 Consecutive days
2021-09-06 Yes
2021-09-06 User_03 Yes
2021-09-07 Yes
2021-09-06 User_04 Yes
2021-09-08 No
2021-09-06 User_05 Yes
2021-09-09 Yes
2021-09-07 User_01 No
2021-09-10 Yes
2021-09-07 User_02 Yes
2021-09-11 Yes
2021-09-07 User_03 Yes
2021-09-07 User_04 No
2021-09-07 User_05 Yes
For User
2021-09-08 User_01 Yes 4
2021-09-08 User_02 Yes Date Present Attended 2 Consecutive days
2021-09-08 User_03 No 2021-09-06 Yes
2021-09-08 User_04 Yes 2021-09-07 No
2021-09-08 User_05 Yes 2021-09-08 Yes
2021-09-09 User_01 Yes 2021-09-09 No
2021-09-09 User_02 Yes 2021-09-10 Yes
2021-09-09 User_03 Yes 2021-09-11 Yes
2021-09-09 User_04 No
2021-09-09 User_05 Yes For User
2021-09-10 User_01 Yes 5
2021-09-10 User_02 No Attended 6 Consecutive days
2021-09-10 User_03 Yes Date Present
2021-09-10 User_04 Yes 2021-09-06 Yes
2021-09-10 User_05 Yes 2021-09-07 Yes
2021-09-11 User_01 Yes 2021-09-08 Yes
2021-09-11 User_02 No 2021-09-09 Yes
2021-09-11 User_03 Yes 2021-09-10 Yes
2021-09-11 User_04 Yes 2021-09-11 Yes
Question 2:
The matches table contains data for cricket matches between different teams and the winner.
Question 3:
Using the transactions table as described below, find out the count of users who transacted for
the first time on a Monday (Not to be mistaken for identifying customers who have transacted
on any Monday).
Question 5:
An e-commerce app allows users to share the product on various social platforms with their
friends before purchasing. A user has to view the product, can share it with friends and can
decide to purchase it or not. The following tables capture the user actions for a few products
a. Product_View
Product_Id Product_Views
1001 1200
1002 1305
1003 1000
1005 700
b. Product_Purchase
Product_Id Product_Shares
1001 200
1003 130
1002 80