Improved database_to_csv.sh so that it can handle more choices