0

I'm under the impression that this command will create a table for you. Is this the wrong idea? I have this:

LOAD DATA LOCAL INFILE '/Users/michael/WebstormProjects/d3_graphs_with_node/public/DFData/ADWORDS_AD_DATA.csv'
INTO TABLE ADWORDS_AD_DATA
FIELDS TERMINATED BY ','
    ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(campaign_id,adgroup_id,ad_group,campaign,account,week,keyword,keyword_state,match_type,max_cpc,clicks,impressions,ctr,avg_cpc,avg_cpm,cost,avg_position,quality_score,first_page_cpc,first_position_cpc,converted_clicks,click_conversion_rate,cost_converted_click,cost_all_conv,total_conv_value,conversions,cost_conv,conv_rate)

I counted the columns and there is 28 and I made exactly 28 entries after IGNORE 1 LINES. I looked at these SO posts and tried to follow the syntax outlined by the MySQL documentation here. Any ideas?

mysql-load-local-infile

import-csv-to-mysql-table

Community
  • 1
  • 1
Sticky
  • 3,671
  • 5
  • 34
  • 58
  • 1
    You are under the wrong impression. This command *loads* data into an existing table. It is analogous to `insert` with a file. – Gordon Linoff Mar 19 '16 at 17:43
  • So would I have to manually make a table with 28 columns with their respective column types? – Sticky Mar 19 '16 at 17:47

1 Answers1

0

Okay manually added table and set the column names and it worked!

A side note, I had 2 versions of MySQL running and that was also giving me confusion as to why the table/database I created in phpmyadmin wasn't showing up in the MySQL shell in the command line. MAMP MYSQL vs system MYSQL

Community
  • 1
  • 1
Sticky
  • 3,671
  • 5
  • 34
  • 58