adding sql functions