== scholia_jinja_for_loops ==

=== query ===
<source lang='sql'>
SELECT
  count(*),
  substr(
    sparql,
    instr(sparql, '{% for') + length('{% for'),  -- Start position right after "{% for"
    instr(substr(sparql, instr(sparql, '{% for')), '%}') - length('{% for')  -- Length of substring
  ) as for_loop_content
FROM
  NamedQuery
WHERE
  sparql LIKE '%{% for%' ESCAPE '\' and for_loop_content like "%in%"
group by for_loop_content
order by 1 desc

</source>


=== result ===
{| class="wikitable" style="text-align: left;"
|+ <!-- caption -->
|-
! align="right"|   count(*) !! for_loop_content
|-
| align="right"|         28 || q in qs %
|-
| align="right"|          1 || q1 in qs %
|-
| align="right"|          1 || doi in dois %
|-
| align="right"|          1 || day in range(-32, 1) %
|}