What are the benefits of using an SQL UPDATE statement like "UPDATE tabelle SET ID2 = ID2 + ID - 25123" in PHP?

When using an SQL UPDATE statement like "UPDATE tabelle SET ID2 = ID2 + ID - 25123" in PHP, you can easily update the values in a specific column of a table by performing arithmetic operations on the existing values. This can be useful for updating multiple rows at once based on a calculation involving other columns in the same table.

<?php
// Connect to the database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// SQL UPDATE statement
$sql = "UPDATE tabelle SET ID2 = ID2 + ID - 25123";

// Execute the SQL statement
if ($conn->query($sql) === TRUE) {
    echo "Records updated successfully";
} else {
    echo "Error updating records: " . $conn->error;
}

// Close the connection
$conn->close();
?>