Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 .sql 文件,其中包含一些数据,如“first_name”、“last_name”、“email”等。
我想要实现的是提取一些字段(比如说“first_name”和“last_name”)并将它们保存到 .csv 文件中。
如果您可以访问数据库,那么您可以使用SELECT ... INTO OUTFILE:
SELECT ... INTO OUTFILE
SELECT first_name, last_name INTO OUTFILE "/path/to/file.csv" FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' FROM mytable;