Task Mysql

MySQL y datos CSV

Importacion :

LOAD DATA LOCAL INFILE 'usuarios.csv' INTO TABLE usuarios FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' (nombre, pass, usuario);

Exportacion :

SELECT * FROM usuarios ORDER BY DATE DESC INTO OUTFILE "usuarios.csv" FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
mysql -u root -p cdr -B -e "select * from \`calldetails\` limit 2;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'

Unix Time

SELECT * , FROM_UNIXTIME( `dateTimeOrigination` ) AS Fecha FROM `calldetails` WHERE `finalCalledPartyNumber` = '7420'
SELECT * , FROM_UNIXTIME( `dateTimeOrigination` ) AS fecha FROM `calldetails` WHERE `finalCalledPartyNumber` = '' AND FROM_UNIXTIME( `dateTimeOrigination` ) LIKE '%' ORDER BY fecha