Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <pre><code>SELECT * FROM TABLE_NAME WHERE b IN(5,7) AND c IN(4,4) </code></pre> </blockquote> <p>This query will return rows, where <code>b</code> is either <code>5</code> or <code>7</code>, AND <code>c</code> is <code>4</code>.</p> <p>What do you mean by "evaluation in pairs?"</p> <p><strong>Update:</strong></p> <p>I'll add one more row to the sample:</p> <pre><code> +----------+----------+----------+ | PK | b | c | +----------+----------+----------+ | 1 | 2 | 3 | +----------+----------+----------+ | 2 | 5 | 4 | +----------+----------+----------+ | 3 | 7 | 9 | +----------+----------+----------+ | 4 | 7 | 4 | +----------+----------+----------+ | 5 | 2 | 9 | +----------+----------+----------+ </code></pre> <p>If you want to match the whole sets, you can use this syntax:</p> <pre><code>SELECT * FROM table_name WHERE (b, c) IN ((2, 3), (7, 9)) </code></pre> <p>This means: "return all rows where <code>b</code> is <code>2</code> and <code>c</code> is <code>3</code> at the same time, OR <code>b</code> is <code>7</code> and <code>с</code> is <code>9</code> at the same time."</p> <p>In the example above, this query will return rows <code>1</code> and <code>3</code></p> <p>But if you rewrite this query the other way around, like this:</p> <pre><code>SELECT * FROM table_name WHERE b IN (2, 7) AND c IN (3, 9) </code></pre> <p>, this will mean "return all rows where <code>b</code> is either <code>2</code> or <code>7</code>, AND <code>c</code> is either <code>3</code> or <code>9</code>).</p> <p>This will return rows <code>1</code>, <code>3</code> and <code>5</code>, since row <code>5</code> satisfies the condition for the second query but not for the first one.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload