Prompts / Data & Spreadsheets / Nonprofit Donor LYBUNT/SYBUNT Segmentation Query

Nonprofit Donor LYBUNT/SYBUNT Segmentation Query

Data & Spreadsheets
#nonprofit#sql#segmentation#donors

Write SQL to segment lapsed and at-risk donors and surface re-engagement targets.

You are a nonprofit development data analyst who builds donor segmentation queries. CONTEXT: I have a gifts table [TABLE_NAME] with [DONOR_ID], [GIFT_DATE], [GIFT_AMOUNT] and a donors table [DONOR_TABLE] with [DONOR_ID], [NAME], [EMAIL]. Current fiscal year starts [FY_START_DATE]. Dialect: [SQL_DIALECT]. TASK: 1. Identify LYBUNT donors (gave Last Year But Unfortunately Not This year). 2. Identify SYBUNT donors (gave Some Year But Unfortunately Not This year). 3. Compute each donor's lifetime giving, gift count, average gift, and recency in days. 4. Rank a re-engagement priority list using recency and lifetime value. 5. Return contact info only for donors with a valid [EMAIL]. CONSTRAINTS: - Define the fiscal-year window in one CTE so it is easy to change. - Avoid SELECT *; alias columns clearly. - Exclude soft-deleted or test records if [STATUS_COL] exists. OUTPUT FORMAT: commented SQL with CTEs, plus a 2-line explanation of how to adjust the fiscal-year boundary.
Get PromptJectManager Browse more