Unable to import csv file due to duplicate id in file - mysql

I have a csv to import to mysql which I have created a table for and am using Table Import Wizard to import the data into this created table.
However, I met with this error of stating that it has duplicate entries in the id column.
The duplicate ids are actually coupled with different days of info. How can I successfully import this into my created table please?
I tried to indicate that this is Unique when creating the table, also tried if it is not Unique.
Snapshot of my csv file

Related

How to import single CSV file with more than one table to MySQL database

I've just found that I can import a CSV file to MySQL table. I tried it on phpMyAdmin, but I also found out that by importing a CSV file, its columns need to match the mysql database table you are importing to. This means one CSV file equals one table only in the SQL database, correct me if I'm wrong though.
The problem is the employee table I'm inserting data to, is related to other tables. There's also the rolemap table where when every employee is inserted in the employee table, the rolemap table also creates a new row for that new employee(only inserts the employee_id generated by the employee table, then the role of the user if admin or not).
The question is can I achieve this logic, by importing a CSV file in phpMyAdmin or any database manager? I'm thinking that maybe there will be some formatting that needs to be done in the CSV file in order to import to different tables in the database. Or is this not possible, that I need to parse the CSV file in a backend and handle how to insert it to each respective table in the database?

I am trying to import ms-access data into SQL Server but I am getting an error saying that column names must be unique. How can I resolve this?

I am trying to import data from an .accdb access file but cannot import it because at least two tables have the same column name. Here is the image of the error.
Rename one of the fields, or import to two or more tables in SQL Server.
Or import via a query where you use an alias for one of the dupe fields.

Importing a MySQL Table from one server to another server

I need to import the table from One MySQL server to another MySQL server. The requirement looks pretty simple but i tried two ways and unable to import the data. Please find the below details and methods I tried to import the data.
We have an existing table in Server A with Engine Type as MyISAM, No primary key and contains duplicate records.
Now, We need to export this table into a new MySQL server (Server B) but the new MYSQL DB has some rules.
Engine should be InnoDB
Every table should contains a primary key.
The below ways i tried to import and failed.
Method 1:-
Exported the data from server A with Outfile command using MySQL Workbench
and tried to import with Infile command but due to the "mandatory primary key" validation all the
rows were not inserted. So to avoid this added an incremental column in new table and tried to
import but again it's failed due to the no.of columns mismatch error
Method 2:-
Configured both the servers in MySQL WorkBench and exported the table in Server A
with MANAGEMENT-> Data Export and tried to Import with MANAGEMENT-> Data Import/Restore
but due to the engines mismatch between the two tables again it's failed to import the data.
(Tried with Dump project folder and self contained folder).
AFAIK, Now I'm left with only one option (which I don't want to do due to the huge data).
Export the data as a CSV file and Import it by using Table Data Import Wizard.
Please guide me is there any other option to import the Data.
What you can try is to add the new auto inc column to your source table (and add the primary key also, to check if there's no problem). To make this complete you can also convert the table to the InnoDB engine and have it so prepared to be copied over with the least friction.

Mysql-workbench import data from csv fails

I want to add fields to into a created table called 'Deporte', i follow the process and when i arrive to finally workbench shows to me
table Deporte has been used, 0 records imported
My table over i want to load data have more fields than my csv file, but in the process of import i can select the fields couples i want to load.
However, if i create a new table with my data, the import process is completed correctly. I have this captures of the procedure that i want:
Thanks for all.
The problem was that my URL fields was not long enough.

Bulk CSV File Import in MySQL Removing duplicates while Importing dynamic colmns from CSV

I have to import CSV File for different clients in my system, some with [,] some [|] Etc… separated. Always very big files.
While importing I need to filter duplicate records, duplicate records should not insert in dB.
Problem is columns can be different for different clients. I have database for every client for CSV DATA which I import every day, Week or month depending on client need. I keep data for every import so we can generate reports & what data we receive in CSV file our system do processing after import.
Data structure example:
Client 1 database:
First_Name | Last_Name | Email | Phone | Ect…
95% data always same every new CSV file. Some records new comes & some records they delete from csv. so our system only process those records those newly imported .
Currently what happening we import data every time in new table. We keep table name with time stamp so we can keep track for import. it Is expensive process, it duplicate records and tables.
Im thinking solution and I need your suggestion on it.
Keeping one table every time import when I import CSV file data in table, I’ll alter existing table add new column, column name will be “current date” (byte or Boolean) add true false on import??
My other question is first time when I import CSV file …I need to write script:
While importing CSV data, if table already exists then my date logic will work else if table does not exist it should create table given or provided “client name” as table name. Challenge is columns I don’t know it should create columns from CSV file.
Table already exist some new records came in it should insert else update.
Is it do able in mysql??
although I have to do something for mssql also but right now I need solution for my sql.
Please help me... im not good in MySQL :(
You can certainly do an insert Or update statement when importing each record.
see here :
https://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
I propose you create a script to dynamically create you table if it doesn't
What is the language that you would use to insert your csv?