I am working with MySql for the first time. I have created a database in mysql with some tables using PHPMYADMIN. One of the table is titled as "City". This table as two column fields 1. City_ID and 2. City. In this City_ID is the primary key with auto increment.
I have the data in CSV format, which I have read into R. From the data frame, I am using the following command to get the City values from R - DF.
City <- as.data.frame(unique(df[,10]))
names(City) <- "City"
I am using the following codes to connect with MySql.
library(RMySQL)
mydb <- dbConnect(MySQL(), user = "root", password = "****", dbname = "pal", host = "localhost")
dbWriteTable(mydb, "City", City, overwrite = TRUE, row.names = FALSE)
This removes the field City_ID and fills the City column of the table with values. Don't know how to resolve this. Most of the work that I do has data in excel or csv formats. And I need to frequently update the tables too. Any thoughts on this.