Adding  sql functions