Table creation: Difference between revisions
J: bugfix
No edit summary |
(J: bugfix) |
||
Line 74:
And, here's an example of sorting:
<lang j>
sortBy=: [ /:"1
from=: cols~ {"0 _ ]
select=: |:
select '*' from stocks sortBy 'price'
┌──────────┬─────┬──────┬────┬─────┐
│date │trans│symbol│qty │price│
├──────────┼─────┼──────┼────┼─────┤
├──────────┼─────┼──────┼────┼─────┤
├──────────┼─────┼──────┼────┼─────┤
│2006-04-06│SELL │IBM │500 │53 │
├──────────┼─────┼──────┼────┼─────┤
│2006-04-05│BUY │MSOFT │1000│72 │
└──────────┴─────┴──────┴────┴─────┘</lang>
Note that this particular example is both overly general in some senses (for example, named column handling has features not demonstrated here) and overly specific in others (for example, I did not implement sort in descending order).
|