Full Table

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

Find (price > 1500)

:keyidcolormarkprice
55RedPeugeot1550
3131RedCitroen2000
4545YellowCitroen1800
6767BrownNissan1700
7171GreenNissan1750
$table->find(
    $table->expr()->gt('price', 1500)
);

Find (price > 1500 and color = "Red")

:keyidcolormarkprice
55RedPeugeot1550
3131RedCitroen2000
$table->find(
    $table->expr()->gt('price', 1500),
    $table->expr()->eq('color', 'Red')
);

Find (price > 1500 or color = "Red")

:keyidcolormarkprice
55RedPeugeot1550
3131RedCitroen2000
4545YellowCitroen1800
6767BrownNissan1700
7171GreenNissan1750
8989RedNissan1500
$table->find(
    $table->expr()->or(
        $table->expr()->gt('price', 1500),
        $table->expr()->eq('color', 'Red')
    )
);

Find (price > 1500 or color = "Red") sorted (mark ASC then price DESC)

:keyidcolormarkprice
3131RedCitroen2000
4545YellowCitroen1800
7171GreenNissan1750
6767BrownNissan1700
8989RedNissan1500
55RedPeugeot1550
$table->find(
    $table->expr()->or(
        $table->expr()->gt('price', 1500),
        $table->expr()->eq('color', 'Red')
    )
)
    ->sort('mark', ['price', 'DESC']);

Find (price > 1500 or color = "Red") sorted (mark ASC then price DESC) limit (1, 3)

:keyidcolormarkprice
4545YellowCitroen1800
7171GreenNissan1750
6767BrownNissan1700
$table->find(
    $table->expr()->or(
        $table->expr()->gt('price', 1500),
        $table->expr()->eq('color', 'Red')
    )
)
    ->sort('mark', ['price', 'DESC'])
    ->limit(1, 3);

Find (price > 1500 or color = "Red") sorted (mark ASC then price DESC) limit (1, 3) find (color match regexp /w/) sorted (price ASC)

:keyidcolormarkprice
6767BrownNissan1700
4545YellowCitroen1800
$table->find(
    $table->expr()->or(
        $table->expr()->gt('price', 1500),
        $table->expr()->eq('color', 'Red')
    )
)
    ->sort('mark', ['price', 'DESC'])
    ->limit(1, 3)
    ->chain()
    ->where(
        $table->expr()->match('color', 'w')
    )
    ->sort('price');

Find ((price > 1600 and color = "Red") or (price < 1600 and color = "Green"))

:keyidcolormarkprice
1414GreenPeugeot1200
3131RedCitroen2000
$table->find(
    $table->expr()->or(
        $table->expr()->and(
            $table->expr()->gt('price', 1600),
            $table->expr()->eq('color', 'Red')
        ),
        $table->expr()->and(
            $table->expr()->lt('price', 1600),
            $table->expr()->eq('color', 'Green')
        )
    )
);

Find (:key IN 52,31,89) sorted (price ASC)

:keyidcolormarkprice
5252BrownCitroen1400
8989RedNissan1500
3131RedCitroen2000
$table->find(
    $table->expr()->in('id', [52, 31, 89])
)
    ->sort('price');