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 theplanning_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
- ❌
WHERE tenant_organization_id = 1
- ❌
WHERE system_status = 'active'
Table of Contents
- Finding People
- Understanding Demographics
- Working with Households
- Contact Information
- Membership and Status
- Date-Based Queries
- Basic Statistics
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:- Data Model - Master joining People tables
- Advanced Queries - Complex analysis and reporting
- Reporting Examples - Real-world ministry applications