reorder sql defn