Add SQL script for the special aggregates