I have a MySQL database table t with just two columns, id which is INT(11) and val which is VARCHAR(255). There are several millions of rows. How to quickly export the a whole column of id? Index is id and val, i.e. id is not unique in the column.
Is
SELECT DISTINCT id FROM t;
the best?
EDIT:
I’d like to save the result into a text file.
To export the unique
ids into a file on the server you can useYou will then find the file
<mysql data dir>/<database name>/all_the_unique_idson the server.If you want to have the file on the client you need to use a MySQL client, e.g. MySQL’s own command line client: