create sql select fuction