half refactored sql record