Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Last active February 23, 2016 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxmartin/51eb7a83acb09d0bcc56 to your computer and use it in GitHub Desktop.
Save tuxmartin/51eb7a83acb09d0bcc56 to your computer and use it in GitHub Desktop.
MySQL - vypsani mailu oddelenych carkou
SELECT email INTO OUTFILE '/tmp/users.txt'
LINES TERMINATED BY ', '
FROM user;
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL,
`email` varchar(40) COLLATE utf8_czech_ci NOT NULL
) AUTO_INCREMENT=4;
INSERT INTO `user` (`id`, `email`) VALUES
(1, 'ahoj@svete.cz'),
(2, 'hello@world.com'),
(3, 'wtf@omg.lol');
ALTER TABLE `user`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`);
ahoj@svete.cz, hello@world.com, wtf@omg.lol,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment