Establish simplified function in mysql database