I'm very new to using SQL, and I'm trying to figure out a way to store a bunch of data that will continually get updated. I know comcating all the data to the end of the current data is a HUGE nono, it takes the relational of of SQL.
I only have two columns, one is UID, and the other SID. The UID is a users ID, and the SID is their account. If they create another account, they will have the same UID. I want to add the SID to their UID, but not add it again if both of the columns are duplicates.
I'm guessing I have to just have a bunch of the same UID's in the DB, or is there a different way I can go about this?
Example:
What I would like:
|-----UID-----|--SID--|
|aa721910fe51 |6811112, 1111114|
|h678910fe761 |4444112|
What I think is the proper way, but not sure how to go about it?
|-----UID-----|--SID--|
|aa721910fe51 |6811112|
|aa721910fe51 |1111114|
|h678910fe761 |4444112|
If I do something like below, It only checks the UID if there is a duplicate, and ignores it. I would like to check the UID, if it exists, check and see if the SID exists, if it doesn't, add it.
INSERT IGNORE INTO users (UID, SID) VALUES ('aa721910fe51', '6811112')
Sorry if this is noobie stuff, i search and I couldn't fine anything.