HomeUsesLinksMy CVContact meMy snippets
InstagramTikTokYouTubeTwitterTwitchGitHubLinkedIn
HomeUsesLinksMy CVContact meMy snippets
04 February 2017

MySQL - export query results to file

SELECT
p.first_name as "Name", p.last_name as "Surname"
FROM persons p
WHERE p.person_type_id= 2
ORDER BY p.created_at DESC
INTO OUTFILE '/tmp/persons.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Results of this query will be saved to file /tmp/persons.csv


VIM - add text to beginning of every lineMySQL - Adding or removing individual SQL modes

Built with Gatsby

© 2025 Michal Slepko & RootScope

Template from Colorhub