mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-30 11:46:58 +03:00
Copy generated SQLs to next pages
This commit is contained in:
parent
dba8e2c84a
commit
b321110f03
@ -190,6 +190,14 @@ sameBirthdayHeisei' <span class="fu">=</span> aggregateRelation <span class="fu
|
||||
<span class="kw">GROUP</span> <span class="kw">BY</span> T1.day <span class="kw">HAVING</span> (<span class="fu">COUNT</span> (T0.name) > <span class="dv">1</span>)</code></pre>
|
||||
</div><div id="restrict-example-1" class="slide section level2">
|
||||
<h1>Restrict Example</h1>
|
||||
<p>Generated SQL:</p>
|
||||
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">SELECT</span> <span class="kw">ALL</span> T1.day <span class="kw">AS</span> f0, <span class="fu">COUNT</span> (T0.name) <span class="kw">AS</span> f1
|
||||
<span class="kw">FROM</span> PUBLIC.person T0 <span class="kw">INNER</span> <span class="kw">JOIN</span> PUBLIC.birthday T1
|
||||
<span class="kw">ON</span> (T0.name = T1.name)
|
||||
<span class="kw">WHERE</span> (T1.day >= <span class="dt">DATE</span> <span class="st">'1989-01-08'</span>)
|
||||
<span class="kw">GROUP</span> <span class="kw">BY</span> T1.day <span class="kw">HAVING</span> (<span class="fu">COUNT</span> (T0.name) > <span class="dv">1</span>)</code></pre>
|
||||
</div><div id="restrict-example-2" class="slide section level2">
|
||||
<h1>Restrict Example</h1>
|
||||
<pre class="sourceCode haskell"><code class="sourceCode haskell"><span class="ot">sameBirthdayHeisei ::</span> <span class="dt">Relation</span> () (<span class="dt">Day</span>, <span class="dt">Int64</span>)
|
||||
sameBirthdayHeisei <span class="fu">=</span> aggregateRelation <span class="fu">$</span> <span class="kw">do</span>
|
||||
p <span class="ot"><-</span> query person
|
||||
|
@ -214,6 +214,19 @@ SELECT ALL T1.day AS f0, COUNT (T0.name) AS f1
|
||||
Restrict Example
|
||||
-----
|
||||
|
||||
Generated SQL:
|
||||
|
||||
~~~~~ {.sql}
|
||||
SELECT ALL T1.day AS f0, COUNT (T0.name) AS f1
|
||||
FROM PUBLIC.person T0 INNER JOIN PUBLIC.birthday T1
|
||||
ON (T0.name = T1.name)
|
||||
WHERE (T1.day >= DATE '1989-01-08')
|
||||
GROUP BY T1.day HAVING (COUNT (T0.name) > 1)
|
||||
~~~~~
|
||||
|
||||
Restrict Example
|
||||
-----
|
||||
|
||||
~~~~~ {.haskell}
|
||||
sameBirthdayHeisei :: Relation () (Day, Int64)
|
||||
sameBirthdayHeisei = aggregateRelation $ do
|
||||
@ -303,6 +316,16 @@ SELECT ALL T1.day AS f0, COUNT (T0.name) AS f1
|
||||
GROUP BY T1.day ORDER BY COUNT (T0.name) DESC
|
||||
~~~~~
|
||||
|
||||
Ordering Example
|
||||
-----
|
||||
|
||||
~~~~~ {.sql}
|
||||
SELECT ALL T1.day AS f0, COUNT (T0.name) AS f1
|
||||
FROM PUBLIC.person T0 INNER JOIN PUBLIC.birthday T1
|
||||
ON (T0.name = T1.name)
|
||||
WHERE (T1.day >= DATE '1989-01-08')
|
||||
GROUP BY T1.day ORDER BY COUNT (T0.name) DESC
|
||||
~~~~~
|
||||
|
||||
Other Features
|
||||
=====
|
||||
@ -422,6 +445,18 @@ SELECT ALL T0.name AS f0, T0.age AS f1, T0.address AS f2,
|
||||
ON (((T0.name = ?) AND (T0.age = ?)) AND (T0.address = ?))
|
||||
~~~~~
|
||||
|
||||
Record Mapping - Placeholders
|
||||
-----
|
||||
|
||||
Generated SQL:
|
||||
|
||||
~~~~~ {.sql}
|
||||
SELECT ALL T0.name AS f0, T0.age AS f1, T0.address AS f2,
|
||||
T1.name AS f3, T1.day AS f4
|
||||
FROM PUBLIC.person T0 INNER JOIN PUBLIC.birthday T1
|
||||
ON (((T0.name = ?) AND (T0.age = ?)) AND (T0.address = ?))
|
||||
~~~~~
|
||||
|
||||
Record Mapping - Record Placeholders
|
||||
-----
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user