Added the sql script to create the functions