New answers tagged


If there are a small number of locations, get rid of the locations table, and simply use an ENUM(...) for the locations. Then no id is needed, and you can use the names directly in events. This assumes an event can have only one location. It it can have multiple locations, then ENUM won't work, and SET may be useful. (No, I don't see ENUM as all that "...


The table is probably ENGINE=InnoDB. The default is probably to commit a transaction after every INSERT. You seem to be inserting one row at a time. Is the input file a list of INSERTs? Where did it come from? If it came from mysqldump, re run the dump with the option to do multi-row inserts. If the data is just text, arrange to use LOAD DATA. Can you ...


If the column never has an underscore other than the one you want to remove, you can use SUBSTRING_INDEX(). update yourtable set yourcolumn = substring_index(yourcolumn,'_',1);



Top 50 recent answers are included