make proper sql