daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Jan 17th, 2018 243 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 345868230   1646198120  1531283146  Keyword_1531283146  1.55    252910000
  2. 745345566   1646198120  1539847239  another_1531276364  2.75    987831000
  3. ...
  4.    
  5. LOAD DATA INFILE '/tmp/mydata.txt' INTO TABLE PerformanceReport;
  6.    
  7. CREATE TABLE foo(myid INT, mymessage VARCHAR(255), mydecimal DECIMAL(8,4));
  8.    
  9. 1   Heart disease kills     1.2
  10. 2   one out of every two    2.3
  11. 3   people in America.      4.5
  12.    
  13. LOAD DATA LOCAL INFILE '/tmp/foo.txt'
  14. INTO TABLE foo COLUMNS TERMINATED BY 't';
  15.    
  16. Query OK, 3 rows affected (0.00 sec)
  17. Records: 3  Deleted: 0  Skipped: 0  Warnings: 0
  18.    
  19. mysql> select * from foo;
  20. +------+----------------------+-----------+
  21. | myid | mymessage            | mydecimal |
  22. +------+----------------------+-----------+
  23. |    1 | Heart disease kills  |    1.2000 |
  24. |    2 | one out of every two |    2.3000 |
  25. |    3 | people in America.   |    4.5000 |
  26. +------+----------------------+-----------+
  27. 3 rows in set (0.00 sec)
  28.    
  29. LOAD DATA LOCAL INFILE '/tmp/foo.txt' INTO TABLE foo
  30. FIELDS TERMINATED BY 't' LINES TERMINATED BY 'n'
  31. (@col1,@col2,@col3) set myid=@col1,mydecimal=@col3;
  32.    
  33. mysql> select * from foo;
  34. +------+-----------+-----------+
  35. | myid | mymessage | mydecimal |
  36. +------+-----------+-----------+
  37. |    1 | NULL      |    1.2000 |
  38. |    2 | NULL      |    2.3000 |
  39. |    3 | NULL      |    4.5000 |
  40. +------+-----------+-----------+
  41. 3 rows in set (0.00 sec)
  42.    
  43. LOAD DATA LOCAL
  44.     INFILE '/tmp/mydata.txt' INTO TABLE PerformanceReport
  45.     COLUMNS TERMINATED BY 't'  ## This should be your delimiter
  46.     OPTIONALLY ENCLOSED BY '"'; ## ...and if text is enclosed, specify here
  47.    
  48. LOAD DATA INFILE '/tmp/test.txt'
  49. INTO TABLE test
  50. FIELDS TERMINATED BY ','
  51. LINES STARTING BY 'xxx';
  52.    
  53. xxx"abc",1
  54. something xxx"def",2
  55. "ghi",3
  56.    
  57. LOAD DATA INFILE 'data.txt'
  58. INTO TABLE tbl_name
  59. FIELDS TERMINATED BY ','
  60. ENCLOSED BY '"'
  61. LINES TERMINATED BY 'rn'
  62.    
  63. mysqlimport -u root -ptmppassword --local test employee.txt
  64.  
  65. test.employee: Records: 3  Deleted: 0  Skipped: 0  Warnings: 0
  66.    
  67. local-infile=1
  68.    
  69. mysql --local-infile -uroot -pyourpwd yourdbname
  70.    
  71. LOAD DATA LOCAL INFILE '/softwares/data/data.csv' INTO TABLE tableName;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top