Convex Functions In Sql