This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM my_table | |
INTO OUTFILE 'my_table.csv' | |
CHARACTER SET euckr | |
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* How to unserialize data using mysql without using php | |
*/ | |
SELECT | |
column_name, | |
IF(SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 1), ':', -1) REGEXP ';}', '', SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 1), ':', -1)) AS fieldname1, | |
IF(SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 2), ':', -1) REGEXP ';}', '', SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 2), ':', -1)) AS fieldvalue1, | |
IF(SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 3), ':', -1) REGEXP ';}', '', SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 3), ':', -1)) AS fieldname2, | |
IF(SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 4), ':', -1) REGEXP ';}', '', SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 4), ':', -1)) AS fieldvalue2, | |
IF(SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 5), ':', -1) REGEXP ';}', '', SUBSTRING_INDEX(SUBSTRING_INDEX(column_name, ';', 5), ':', -1)) AS fieldname3, |