title: How would I go about sequentially comparing values in an array?
body: <p>I was given an assignment that basically involves performing a SQL query for 2 “indexes” which you can imagine as just 2 categories of things. For example, we were provided a list like this for example:</p>
  <p>[“A LA PIPE”, “P GROUP 3”]</p>
  <p>And we were asked to basically compare the numeric results that result from inputting each of those String index names into different parts of the query.</p>
  <p>My question is how would I design the logic to compare more than just 2 indexes, and to do it in order? For example, if there were 4 total names, how would I compare the results of:</p>
  <pre><code>(0, 1) (0,2) (0,3) (0,4) (1, 0) (1, 2) (1,3) (1,4)
  </code></pre>
  <p>In that pattern? Would this involve nested for loops? Basically, saying grab this current value and the value next to it, then run the query? Is this the most efficient way?</p>