Basic Calendar Queries
Start here to learn the fundamentals of querying your church’s calendar and facility data. Each example builds your confidence with SQL while solving real scheduling challenges.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 Calendar module live in theplanning_center
schema. Always prefix table names with planning_center.
in your SQL.
✅ CORRECT: SELECT * FROM planning_center.calendar_events
❌ INCORRECT: SELECT * FROM calendar_events
Row Level Security (RLS)
Row Level Security automatically handles:- tenant_organization_id – isolates data to your organization
- system_status – returns active records by default
- ❌
WHERE tenant_organization_id = 1
- ❌
WHERE system_status = 'active'
Table of Contents
- Viewing Events
- Event Instances and Scheduling
- Resources and Rooms
- Resource Bookings
- Date and Time Queries
- Tags and Categories
Viewing Events
List All Events
Active and Approved Events
Search Events by Name
Event Instances and Scheduling
Upcoming Event Instances
This Week’s Schedule
Recurring Events
Events by Day of Week
Resources and Rooms
List All Resources
Available Rooms
Equipment Inventory
Resources Expiring Soon
Resource Bookings
Current Bookings
Room Schedule for Specific Date
Find Available Resources
Resource Utilization Summary
Date and Time Queries
Today’s Events
This Month’s Events
Weekend Events
Events by Time of Day
Tags and Categories
Events with Tags
Popular Tags
Tips for Writing Calendar Queries
1. Handle All-Day Events
2. Work with Timestamps
3. Calculate Duration
4. Check Resource Availability
5. Format Times for Display
Common Issues & Solutions
Issue: Events appearing multiple times
Solution: You might be joining to event instances - use DISTINCT or GROUP BY.Issue: Missing recurring events
Solution: Check the date range includes future instances, not just the master event.Issue: Resources showing as available when booked
Solution: Ensure your time comparison includes both start AND end times for overlaps.Issue: All-day events not showing
Solution: Remember to check both the date AND the all_day_event flag.Next Steps
Ready for more complex queries? Check out:- Advanced Queries - Conflict detection, optimization, and analytics
- Reporting Examples - Complete reports you can use immediately