How to create an update query in Drupal 10

To create an update query in Drupal 10

use Drupal\Core\Database\Database; 

$conn = Database::getConnection();

 $field = [
   'uid' => '5',
   'name' => 'Dlearn',
   'mail' => 'learndrupalway@gmail.com',
   'status' => 1,
 ];

 $query = $conn->insert('users_field_data', 'ufd')
   ->fields($field)
   ->query->execute();

Category