I'm a database beginner, I met an issue throughout my study.
I'm now likely to update one table of my database by posting a text file through phpMyAdmin. Everything labored great aside from handling with rows which has same customer_ID.
The row includes a area known as "customer_ID", and that i cannot get this to a principal key, because the initial text file accustomed to populate the database consists of multiple rows for any single customer_ID, so database must allow multiple rows for just one user id.
I populated the database using the import text file, no error. However, now I have to update the database by having an update text file, the client_id inside the update text file are already been around(populated) within the database, therefore if I update the database with this particular up-to-date text file(with the "import" function in PhpMyAdmin), the present rows with similar customer_ID won't be up-to-date, but another row with similar customer_ID is going to be produced, which isn't precisely what I would like.
I believe this can be a dilemma, basically might make the clientidentification a principal key, the update process works perfectly, consider I have to allow customer_id showing up in multiple rows within the database inhabiting process, and so i could not make customer_id a principal key.
Please pardon for that trivial question.I question if experts could produce some suggestion or some related blood pressure measurements? Thanks ahead of time for that help.
I believe the simplest method of doing this really is adding an additional identifier area. Give a filed known as 'id' alongside 'customer_id' making 'id' primary.
You have to build your update file follow this kind of format:
UPDATE table SET field1 = value, field2 = value WHERE customer_ID = existing value
However in which you have multiple rows with similar customer id which will update all of the rows, that is most likely not what you would like. Which means you need another id area (as Ray states), that is unique, increase by using their id
...WHERE id = existing value