I am very new to SQL (like today new) and I have a question. I'm trying to copy data from one table into another table. I know how to do this from the internet but my issue is, I need to skip any data that is already there. Here's my scenario. We have monitoring software that logs new users every time it encounters one. We have an old database with thousands of users that we use as our database, but we had to switch to a different database for a short time due to a server outage. This means that we have some users on the new database, but most on the old. There are also duplicates since everyone that was logged in the old had to be re-logged in the new when the software encountered a 'new user' that wasn't in the new database.
What I want to do is copy all the new users in the new database over to the old database, but skip any users that are already in the old database.
How can this be done? Sorry for the long confusing paragraph. Please remember I'm very new to SQL and don't know squat. Thanks in advance.
Edit: more info: Here is how my tables are set up. I have 2 databases 'bat' and 'bat2'. bat2 is the new one, bat is the old one.
+---------------+
| Tables_in_bat |
+---------------+
| BAT_ban |
| BAT_kick |
| BAT_mute |
| BAT_players |
| BAT_web |
| bat_ban |
| bat_comments |
| bat_kick |
| bat_mute |
| bat_players |
| bat_web |
+---------------+
+----------------+
| Tables_in_bat2 |
+----------------+
| BAT_ban |
| BAT_kick |
| BAT_mute |
| BAT_players |
| bat2_comments |
+----------------+
I will need to merge BAT_players from the new one into BAT_players in the old one. the lowercase tables are a different story so ignore those.
The structure of the BAT_players table looks like this:
+------------------+----------------------------------+-----------------+---------------------+---------------------+
| BAT_player | UUID | lastip | firstlogin | lastlogin |
+------------------+----------------------------------+-----------------+---------------------+---------------------+
| 00meow9 | 21826e64a2974911a0fe542bf11e3901 | 73.163.22.154 | 2021-05-06 10:49:49 | 2021-05-06 10:49:49 |
| 0800Nummer | bb7bd784c7804834b2df56a6c76d53da | 85.250.79.8 | 2021-05-04 13:43:28 | 2021-05-08 08:04:33 |
| 1angelfish | 6c7ebb3197d04d71a7976bd830abe452 | 68.131.116.38 | 2021-05-03 20:46:36 | 2021-05-07 17:32:15 |
The UUID is something that will stay consistent throughout the 2 files.