Skip to main content

Basic People Queries

Start with these foundational queries to explore your church database. Each example builds your SQL confidence while providing immediate ministry value.

Query Customization Required

These example queries demonstrate common patterns but may require adjustments to match your specific database schema and field names. Test thoroughly in your environment before use.

Query Requirements

Schema Prefix

IMPORTANT: All tables in the Planning Center People module live in the planning_center schema. Always prefix table names with planning_center. in every query. ✅ CORRECT: SELECT * FROM planning_center.people_people ❌ INCORRECT: SELECT * FROM people_people

Row Level Security (RLS)

Row Level Security automatically filters results for:
  • tenant_organization_id – only data from your organization
  • system_status – only active records by default
Do not add these filters manually—RLS applies them for you and redundant conditions can slow queries or hide data:
  • WHERE tenant_organization_id = 1
  • WHERE system_status = 'active'
Trust the built-in RLS policies to keep your results scoped correctly while you focus on ministry-specific filters.

Table of Contents

Finding People

List Active People

Search by Name

Recent Additions

Find by Person ID

Understanding Demographics

Age Distribution

Children and Students

Gender Breakdown

Upcoming Birthdays

Working with Households

List All Households

Find Household Members

Large Families

Single-Person Households

Contact Information

People with Email Addresses

People with Phone Numbers

Complete Contact Info

People Missing Contact Info

Membership and Status

Membership Levels

New Members

Permission Levels

Inactive People

Date-Based Queries

Anniversary This Month

People Added by Month

Long-Time Members

Basic Statistics

Overall Demographics Summary

Age Group Distribution

Household Statistics

Tips for Writing Queries

1. Always Filter by Status

2. Handle NULL Values

3. Case-Insensitive Searches

4. Date Calculations

5. Use Proper Joins

Common Issues & Solutions

Issue: Duplicate people in results

Solution: Check your joins and consider using DISTINCT.

Issue: Missing people who should appear

Solution: Verify status = ‘active’ and check relationship joins.

Issue: Age calculations returning NULL

Solution: Ensure birthdate IS NOT NULL before calculating.

Issue: Contact info not showing

Solution: Use LEFT JOIN for optional data like emails and phones.

Next Steps

Ready for more complex queries? Continue with: