I refactored a project and wanted to try out PostgreSQL instead of MySQL. I now want to migrate the table contents of some tables.
The problem is, when I use a select query like this (don't bother about the names, is just an example)
SELECT id AS id_x, name AS name_x, name2 AS name2_x
I want to export the table data and import it into MySQL. The problem is, that the syntax for INSERT INTO is different in MySQL and PostgreSQL. I don't want to export the whole table, because I also changed some parts of the structure, tried to make it more performant etc. So I just want to get the table data, but I need those AS x thing, because the names of the columns have changed
I already found several links on this topic.
I can use mysqldump to dump the table and set the --compatible=name parameter. The problem here is, that I can't add a SELECT statement, right? I can only add a where check.
Then, I could use the mysql command to export the query I want, but mysql doesn't have any compatible parameter. How would I achieve that?