SQL Questions For Interview
SQL Questions For Interview
Users
Userid (primaryKey) INT
City Varchar
State Varchar
Orders
Orderid (primaryKey) INT
Transaction
TransactionId (primaryKey) INT
PaymentMode VarChar
FinalPaymentAmount INT
GatewayTransactionId VarChar
Returns
DisputeId (primaryKey) INT
ReturnBookedOn BIGINT
ReturnType INT
RefundValue INT
BuyerRefundedOn BIGINT
Q.1 Find the total number of users from ‘Maharashtra’ who registered on the App in the last 60
Days and placed an order at least once on the platform ?
Exp Result - Total User Count
Q.2 Find the list of users from ‘Bihar’ who placed an order on 100% Advance in the last 30
days?
Exp Result - UserId, Total Orders, Total Order Value, LastOrderDate
Q.5 Find the percentage of returns booked our of the total orders placed in the last 30 Days? Exp
result - Percentage of Returns
Q.6 Find the total no of buyers who have placed an order once but never booked a return ? Exp
result - Total user Count
Q.7 Find the total Users who have received refunds of more than Rs.10000 in the last 30 days? Exp
result - userid,Total Orders Placed (lifetime), Total Returns Booked, Last Refund Date, Total Refund
Value, Total No of Genuine Returns, Total No of Non-Genuine Returns
Q.1 Bucketing users into Large, Medium and small. Size is derived based on the sales contribution
of the user at a platform level. Definitions: (In terms of order Value)
- Large: TOP 25% contributors
- Medium: Next 50%
- Small: Last 25%
Expected Outcome: UserID, % Contribution to the platform sales and Size-bucket
Q2. Cohort analysis: A Cohort can be defined as a set of users who place their 1st order in the same
month and analyse their count month on month. Expected outcome:
1st order M0 M1 M2 M3 M4
Month
Q3. A seller is considered to have breached SLA if the order placed and order ready time stamps
are greater than 3 days. Find out the top 10 percentile of sellers causing delays on a platform level.
Expected Outcome: Seller ID, contribution on platform, Delay % of seller
Q1. User churn: Model data to be able to understand user behaviour and indicators of churn.
(Hints:
- Time period between a delivery to next order for a user
- Avg time period - delivery to next placed
- Number of orders and gap between order placement)
Expected Outcome:
- Format of output and what are you trying to measure
- Way to read the output
- How to identify key entries in the output which can indicate user churn or factor contributing
to user churn.