{"id":2572,"date":"2022-03-24T06:14:17","date_gmt":"2022-03-24T05:14:17","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2572"},"modified":"2022-03-24T08:40:31","modified_gmt":"2022-03-24T07:40:31","slug":"add-several-data-from-external-table-to-a-mysql-table","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=2572","title":{"rendered":"import an external table to a mysql table"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>You can use a graphical interface to prepare the rows to insert in mysql table: be careful that a) the number of columns be matching with the mysql table rows number and b) the order of columns be the same.<\/li><li>Save your date as csv: in this way you will be able to make further modifications to your data: i.g. you could add new <code>,NULL,<\/code>columns (because in librecalc if a column is empty at the end of a file that column is not added).<\/li><li>Be very careful with comma (<code>,<\/code>) within the columns, if you import the table in mysql with comma as column separator. You should avoid commas within a column, if you use commas as separator.<\/li><li>In phpmyadmin <code>import<\/code> your csv file as a new table. As and of line you can set <code>\\n<\/code> if yout line ends with something like &#8220;NULL&#8221;. Otherwise, if you rows ends with &#8220;NULL&#8221;, you will get an undesired column at the end of teh impoorted table.<\/li><li>Don&#8217;t worry if the columns <strong>type<\/strong> doesn&#8217;t match with the destination mysql table: this is negligible.<\/li><li>In sql do this command: <\/li><\/ul>\n\n\n\n<p>INSERT IGNORE<br>INTO your_destination_table<br>SELECT *<br>FROM the_new_data_table-from-csv;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Using <code>insert IGNORE<\/code> you can <em>avoid<\/em> to delete the ID beginning column, if it is simply an autoincrement one.<\/li><li>Your new rows should have been added to your destination table: done!<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>You can use a graphical interface to prepare the rows to insert in mysql table: be careful that a) the number of columns be matching with the mysql table rows number and b) the order of columns be the same. Save your date as csv: in this way you will be able to make further &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=2572\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;import an external table to a mysql table&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[579],"tags":[744,733,745,11],"class_list":["post-2572","post","type-post","status-publish","format-standard","hentry","category-database","tag-add-new-rows","tag-merge","tag-merge-data","tag-mysql"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2572"}],"version-history":[{"count":6,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2572\/revisions"}],"predecessor-version":[{"id":2578,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2572\/revisions\/2578"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}