Thursday, May 21, 2026

SQL Scenario-Based Interview Questions (36 - 50)

 

36. How do you identify inactive customers?

Find customers with no orders in last N months.


37. How do you find repeated transactions?

Group by transaction attributes and filter count > 1.


38. How do you identify fraud transactions in SQL?

Flag duplicate, unusual, high-frequency, or abnormal-value transactions.


39. How do you find consecutive duplicate values?

Use LAG() to compare current row with previous row.


40. How do you split full name into first and last name?

Use string functions like SUBSTRING, CHARINDEX, or SPLIT_PART.


41. How do you combine first and last name?

Use concatenation (first_name || last_name or CONCAT()).


42. How do you remove leading and trailing spaces?

Use TRIM().


43. How do you convert text to uppercase?

Use UPPER().


44. How do you convert text to lowercase?

Use LOWER().


45. How do you extract year from date?

Use YEAR(date_column).


46. How do you extract month from date?

Use MONTH(date_column).


47. How do you extract day from date?

Use DAY(date_column).


48. How do you calculate age from DOB?

Subtract birth year from current year with date adjustment.


49. How do you find weekend dates?

Filter dates where weekday is Saturday or Sunday.


50. How do you find business days only?

Exclude weekends and holidays.


Bhagavad Gita Wisdom #shorts

https://www.youtube.com/playlist?list=PLQM-BpTd9ZSumxwKgJjuJjlx2OcP_W516