Trigger to count number of Contacts associated with an Account

You can use the following trigger to count the number of Contact records associated with an account record. Note: For existing records, do a one time data load with the count. Sample Trigger: