Insert 1 milion record |
I have many record that my operator have to insert it to database
Also i have to check this record's ID for existing it in database What is best way to add them in database and check existing ID in database Example: Name ID Omid 1 Tohid 2 Saed 3 Abbas 4 Suppose referenced records is 1 million I want to know how add records in database and check which id is duplicate
Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like
ID isnt. I would have it as primary key then problem is solved
(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like Ok for insert ID,my problem solved. Now how do i insert many record?(about 1 million)
(09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like you can do from code level but it is not recommended. I found it is easier just use this https://dev.mysql.com/doc/refman/5.7/en/load-data.html ie. using command from mysql > LOAD DATA INFILE 'users.txt' INTO TABLE yourdb.users; /* Assume you have db name as yourdb and table users, your users.txt should be comma seperated */ Try a simple test file with few names to see how it goes then you can go from there.
(09-29-2017, 02:17 PM)ciadvantage Wrote:(09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like It is good solution THanks
(09-29-2017, 02:17 PM)ciadvantage Wrote:(09-29-2017, 01:31 PM)omid_student Wrote:(09-29-2017, 01:25 PM)ciadvantage Wrote: Well if ID is primary key then it should be auto-incremented as you set it, so it is taken care off already. Your example is like Hey i cannot access to command line mysql How do it?
|
Welcome Guest, Not a member yet? Register Sign In |