Full Table
:key | id | color | mark | price |
---|---|---|---|---|
5 | 5 | Red | Peugeot | 1550 |
14 | 14 | Green | Peugeot | 1200 |
22 | 22 | Blue | Peugeot | 1400 |
31 | 31 | Red | Citroen | 2000 |
45 | 45 | Yellow | Citroen | 1800 |
52 | 52 | Brown | Citroen | 1400 |
67 | 67 | Brown | Nissan | 1700 |
71 | 71 | Green | Nissan | 1750 |
89 | 89 | Red | Nissan | 1500 |
Find (price > 1500)
:key | id | color | mark | price |
---|---|---|---|---|
5 | 5 | Red | Peugeot | 1550 |
31 | 31 | Red | Citroen | 2000 |
45 | 45 | Yellow | Citroen | 1800 |
67 | 67 | Brown | Nissan | 1700 |
71 | 71 | Green | Nissan | 1750 |
$table->find( $table->expr()->gt('price', 1500) )
Find (price > 1500 and color = "Red")
:key | id | color | mark | price |
---|---|---|---|---|
5 | 5 | Red | Peugeot | 1550 |
31 | 31 | Red | Citroen | 2000 |
$table->find( $table->expr()->gt('price', 1500), $table->expr()->eq('color', 'Red') )
Find (price > 1500 or color = "Red")
:key | id | color | mark | price |
---|---|---|---|---|
5 | 5 | Red | Peugeot | 1550 |
31 | 31 | Red | Citroen | 2000 |
45 | 45 | Yellow | Citroen | 1800 |
67 | 67 | Brown | Nissan | 1700 |
71 | 71 | Green | Nissan | 1750 |
89 | 89 | Red | Nissan | 1500 |
$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)
:key | id | color | mark | price |
---|---|---|---|---|
31 | 31 | Red | Citroen | 2000 |
45 | 45 | Yellow | Citroen | 1800 |
71 | 71 | Green | Nissan | 1750 |
67 | 67 | Brown | Nissan | 1700 |
89 | 89 | Red | Nissan | 1500 |
5 | 5 | Red | Peugeot | 1550 |
$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)
:key | id | color | mark | price |
---|---|---|---|---|
45 | 45 | Yellow | Citroen | 1800 |
71 | 71 | Green | Nissan | 1750 |
67 | 67 | Brown | Nissan | 1700 |
$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)
:key | id | color | mark | price |
---|---|---|---|---|
67 | 67 | Brown | Nissan | 1700 |
45 | 45 | Yellow | Citroen | 1800 |
$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"))
:key | id | color | mark | price |
---|---|---|---|---|
14 | 14 | Green | Peugeot | 1200 |
31 | 31 | Red | Citroen | 2000 |
$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)
:key | id | color | mark | price |
---|---|---|---|---|
52 | 52 | Brown | Citroen | 1400 |
89 | 89 | Red | Nissan | 1500 |
31 | 31 | Red | Citroen | 2000 |
$table->find( $table->expr()->in('id', [52, 31, 89]) ) ->sort('price')
Find (:key IN 52,31,89) sorted (price ASC) but filtered on key
:key | id | color | mark | price |
---|---|---|---|---|
52 | 52 | Brown | Citroen | 1400 |
89 | 89 | Red | Nissan | 1500 |
31 | 31 | Red | Citroen | 2000 |
$table->find( $table->expr()->in(new KeyField(), [52, 31, 89]) ) ->sort('price')