I would like to know if it is possible to make a INSERT
and a UPDATE
in the same query, that is, in the same operation.
I'm using the following to do both.
public Connection conn = null;
...
conn = DriverManager.getConnection (url, userName,password);
...
String Query_SQL_UPDATE = "UPDATE users SET name = 'exemplo';";
String Query_SQL_INSERT = "INSERT INTO 'users_logs' (user_id, name) VALUES ('1','demo');";
PreparedStatement Update_SQL = conn.prepareStatement(Query_SQL_UPDATE);
Update_SQL.execute();
PreparedStatement Insert_SQL = conn.prepareStatement(Query_SQL_INSERT);
Insert_SQL.execute();
Is there any way to do this, or even simplify these commands? If so, what are they?