Okay, so let me just state this first. I am very new to SQL and I don't know a lot about it. I just recently started using it and I've been trying to learn it and improve. Please explain anything you state, as I may not understand common terms etc.
The SQL code I wrote now works like I intend it to, but the string seems obnoxious and made me think that this can't be quite right.
INSERT INTO reputations(uuid, warn, bandate, reasons, mods)
VALUES ('{0}', '{1}', '{2}', CONCAT(reasons, '{3}'), CONCAT(mods, '{4}'))
ON DUPLICATE KEY UPDATE warn = '{1}',
bandate = '{2}',
reasons=CONCAT(reasons, '{3}'),
mods=CONCAT(mods, '{4}')
In my Java code it looks like this:
As you also probably can see, I have no clue on how to properly format/indent it all for use like this. Any tips would be greatly appreciated.
I should also explain that the {n}
's are just spaces where I replace it with the information I want. For example, I replace all {0} with an UUID.
So, my question is. Is there a better way to do this? Any tips or help would be appreciated. Cheers!