refactoring (ugly) methods to set the correct SQL