Sunday, May 24, 2026

SQL Scenario-Based Interview Questions ( 85 -100)

 

86. How do you find least-selling product?

Group by product and sort by total sales asc.


87. How do you calculate average order value?

Total revenue ÷ total orders.


88. How do you find repeat customers?

Find customers with more than one order.


89. How do you identify one-time customers?

Find customers with exactly one order.


90. How do you segment customers by spending?

Use CASE on total spend ranges.


91. How do you find highest sales month?

Group by month and sort by total sales desc.


92. How do you compare YoY sales?

Compare same period current year vs previous year.


93. How do you detect sales drop?

Compare current period sales with previous period using LAG().


94. How do you find seasonal trends?

Aggregate sales by month/quarter across years.


95. How do you calculate contribution % by category?

Category sales ÷ total sales * 100.


96. How do you rank products by sales?

Use RANK() on sales descending.


97. How do you find top customer per region?

Use ROW_NUMBER() partitioned by region ordered by sales desc.


98. How do you identify null-heavy columns?

Profile columns using NULL counts.


99. How do you perform data quality check in SQL?

Validate nulls, duplicates, formats, and referential integrity.


100. How do you explain SQL approach in interview?

Explain logic first, then SQL method, then optimization approach.