sql functions updated