Apart from the SQL query, all of these functions are the same. I would make a single function that takes the column name as an argument.