0% found this document useful (0 votes)
8 views

SQL Questions For Interview

There are some good questions for practice

Uploaded by

Naman Gulati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

SQL Questions For Interview

There are some good questions for practice

Uploaded by

Naman Gulati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DB Schema

Users
Userid (primaryKey) INT

Company Name Varchar

City Varchar

State Varchar

Signup Date BIGINT

Orders
Orderid (primaryKey) INT

Order Date BIGINT

Order Value Double(10,2)

Userid (foreignKey) INT

sellerID (foreign Key) INT

TransactionId (foreignKey) INT

Order Ready Date BIGINT

Delivery Date BIGINT

Transaction
TransactionId (primaryKey) INT
PaymentMode VarChar

FinalPaymentAmount INT

GatewayTransactionId VarChar

Returns
DisputeId (primaryKey) INT

ReturnBookedOn BIGINT

ReturnType INT

orderId (foreignKey) INT

RefundValue INT

BuyerRefundedOn BIGINT

** ReturnType=1 is Genuine, ReturnType=2 is NonGenuine

Stage 1: Basic SQL

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.3 Generate a report of users who have never placed an Order ?


Exp Result - userid, city, state, signup Date
Q.4 Find the list of all the buyers from Assam & West Bengal who have placed more than 50
Orders in the last 6 months with at least 1 order on Advance Payment mode? Exp Result - userid,
state, Total order Count, Avg Order Value, No of Orders in Advance mode

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

Stage 2: Level 2 of execution (Attempt any two questions from stage 2)

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

Jan’20 Count of Count of Count of Count of Count of


ussers who users from M0 users from M0 users from M0 users from M0
placed there who placed an who placed an who placed an who placed an
1st order in order in Feb order in Mar order in Apr order in May
Jan

Feb’20 Count of Count of Count of Count of Count of


users who users from M0 users from M0 users from M0 users from M0
placed there who placed an who placed an who placed an who placed an
1st order in order in Mar order in Apr order in May order in Jun
Feb

Mar’20 Count of Count of Count of Count of Count of


users who users from M0 users from M0 users from M0 users from M0
placed there who placed an who placed an who placed an who placed an
1st order in order in Apr order in May order in Jun order in Jul
Mar

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

Stage 3: Analytical thinking

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.

You might also like