SQL: Reordered statements to fix import