mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-06 04:16:21 +03:00
Publish
This commit is contained in:
parent
b321110f03
commit
2e92c4e3b6
@ -252,6 +252,13 @@ birthdayHeiseiDesc <span class="fu">=</span> aggregateRelation <span class="fu"
|
||||
orderBy personCount <span class="dt">Desc</span>
|
||||
return <span class="fu">$</span> gbd <span class="fu">><</span> personCount</code></pre>
|
||||
<p>orders by the number of people born on the same Heisei period dates:</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">ORDER</span> <span class="kw">BY</span> <span class="fu">COUNT</span> (T0.name) <span class="kw">DESC</span></code></pre>
|
||||
</div><div id="ordering-example-2" class="slide section level2">
|
||||
<h1>Ordering Example</h1>
|
||||
<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)
|
||||
@ -334,6 +341,13 @@ personAndBirthdayP2 <span class="fu">=</span> relation' <span class="fu">$</spa
|
||||
<span class="ot">=></span> (a <span class="ot">-></span> b) <span class="ot">-></span> <span class="dt">Placeholders</span> a <span class="ot">-></span> <span class="dt">Placeholders</span> b
|
||||
<span class="ot">(|*|) ::</span> <span class="dt">Placeholders</span> (a <span class="ot">-></span> b) <span class="ot">-></span> <span class="dt">Placeholders</span> a <span class="ot">-></span> <span class="dt">Placeholders</span> b</code></pre>
|
||||
<p>Generated SQL:</p>
|
||||
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">SELECT</span> <span class="kw">ALL</span> T0.name <span class="kw">AS</span> f0, T0.age <span class="kw">AS</span> f1, T0.address <span class="kw">AS</span> f2,
|
||||
T1.name <span class="kw">AS</span> f3, T1.day <span class="kw">AS</span> f4
|
||||
<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 = ?) <span class="kw">AND</span> (T0.age = ?)) <span class="kw">AND</span> (T0.address = ?))</code></pre>
|
||||
</div><div id="record-mapping---placeholders-1" class="slide section level2">
|
||||
<h1>Record Mapping - Placeholders</h1>
|
||||
<p>Generated SQL:</p>
|
||||
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">SELECT</span> <span class="kw">ALL</span> T0.name <span class="kw">AS</span> f0, T0.age <span class="kw">AS</span> f1, T0.address <span class="kw">AS</span> f2,
|
||||
T1.name <span class="kw">AS</span> f3, T1.day <span class="kw">AS</span> f4
|
||||
<span class="kw">FROM</span> PUBLIC.person T0 <span class="kw">INNER</span> <span class="kw">JOIN</span> PUBLIC.birthday T1
|
||||
|
Loading…
Reference in New Issue
Block a user