Here is the code I'm using right now that gives a MySQL syntax error:
UUID uuid = player.getUniqueId();
long uuid_m = uuid.getMostSignificantBits(), uuid_l = uuid.getLeastSignificantBits();
String query = String.format(
"INSERT INTO players (uuid_m, uuid_l, name, clan, xp, rank)" +
"SELECT * FROM SELECT CONCAT('%d', '%d', '%s', '%s', '%d', '%d') AS tmp" +
"WHERE NOT EXISTS (SELECT CONCAT(uuid_m, uuid_l) FROM players WHERE uuid_m = '%d' AND uuid_l = '%d')" +
"LIMIT 1;", uuid_m, uuid_l, player.getName(), "TestClan", 0, 0, uuid_m, uuid_l);
I wrote the code in Java, but I tried making it as readable as possible and I don't think there's really anything specific to Java itself in the code. The table in my database is called "players" and it has columns (uuid_m long, uuid_l long, varchar(50) name, varchar(50) clan, xp int, rank int). I've considered just using varchar(32) instead of splitting the UUID into two, but I did some calculations and that'll take 4 times as much space. I'm fairly new to MySQL, but I want to try and keep everything efficient.