Full Table

:keyidcolormarkprice
55RedPeugeot1550
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen2000
4545YellowCitroen1800
5252BrownCitroen1400
6767BrownNissan1700
7171GreenNissan1750
8989RedNissan1500

Update (price > 1500 => price / 10)

:keyidcolormarkprice
55RedPeugeot155
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen180
5252BrownCitroen1400
6767BrownNissan170
7171GreenNissan175
8989RedNissan1500
$table->updateMultiple(
    $table->expr()->gt('price', 1500),
    function ($row) {
        $row['price'] /= 10;
        return $row;
    }
);

Delete (price < 180 or color = "brown")

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen180
8989RedNissan1500
$table->deleteMultiple(
    $table->expr()->or(
        $table->expr()->lt('price', 180),
        $table->expr()->eq('color', 'brown', false)
    )
);

Update an existing element

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen2000
8989RedNissan1500
$table->update([
    'id'    => 45,
    'price' => '2000',
]);

Update the same element but with its key

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen2100
8989RedNissan1500
$table->update(['price' => '2100'], 45);

Insert an element

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen2100
8989RedNissan1500
9090GreenBMW3000
$table->insert([
    'mark'  => 'BMW',
    'price' => '3000',
    'color' => 'Green',
]);

Upsert an element

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen2100
8989RedNissan1500
9090GreenBMW3000
9191RedBMW3100
$table->upsert([
    'mark'  => 'BMW',
    'price' => '3100',
    'color' => 'Red',
]);

Upsert the same element

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
3131RedCitroen200
4545YellowCitroen2100
8989RedNissan1500
9090GreenBMW3000
9191YellowBMW3100
$table->upsert(
    ['color' => 'Yellow'],
    $table->getLastInsertedKey()
);

Delete one element

:keyidcolormarkprice
1414GreenPeugeot1200
2222BluePeugeot1400
4545YellowCitroen2100
8989RedNissan1500
9090GreenBMW3000
9191YellowBMW3100
$table->delete(31);