SQL · Case 02

Precedence
Logic

Parentheses in the right place: boolean filter precedence applied to recovering decision-level leads that went cold in the commercial funnel.

15 New opportunities
30+ Days of inactivity filtered
85+ Minimum lead score
Context

This case demonstrates the strategic use of advanced boolean logic to recover high-value opportunities that went cold in the commercial funnel due to lack of interaction.

About the case

A critical portion of leads in decision-level roles (coordinators, directors and C-Level) had no commercial team interactions for over 30 days, representing a qualified revenue loss risk. I developed an audit query using parentheses to ensure correct filter precedence, isolating high-score leadership profiles with prolonged inactivity. The action immediately opened 15 new business opportunities.

SQL
-- Recuperação de Leads VIP Inativos

SELECT
    nome,
    cargo,
    score,
    dias_desde_ultimo_contato
FROM
    leads_potenciais
WHERE
    (cargo = 'coordenador'
     OR cargo = 'diretor'
     OR cargo = 'ceo')
    AND score > 85
    AND dias_desde_ultimo_contato > 30;
Process visualization
Business explanation

In CRM, time is the biggest enemy of conversion. The longer a qualified lead goes without contact, the lower the chances of closing. This query acts as an operational safety system, preventing investment in high-profile acquisition from being wasted due to process failures.