@@ -0,0 +1,53 @@
1+# Project:M36 DataFrames
3+Users of typical relational algebra engines have come to expect sorting and limiting of query results despite the fact that relations do not support ordering. To that end, Project:M36 supports converting relations to "data frames" to support sorting on attributes and limiting the maximum tuple count in the result set.
5+The equivalent feature in SQL is invoked by the `ORDER BY`, `LIMIT`, and `OFFSET` clauses.
9+From within the `tutd` console, converting a relation to be sorted as a data frame is invoked using the `:showdataframe` command.
12+:showdataframe <relational expression> orderby {<attribute {ascending,descending}>} {offset <num>} {limit <num>}
15+The default sort order is `ascending`.
20+TutorialD (master/main): :showdataframe s orderby {status}
21+┌──┬───────────┬─────────┬────────────┬────────────────┐
22+│DF│city::Text↕│s#::Text↕│sname::Text↕│status::Integer⬆│
23+├──┼───────────┼─────────┼────────────┼────────────────┤
24+│1 │"Paris" │"S2" │"Jones" │10 │
25+│2 │"London" │"S1" │"Smith" │20 │
26+│3 │"London" │"S4" │"Clark" │20 │
27+│4 │"Athens" │"S5" │"Adams" │30 │
28+│5 │"Paris" │"S3" │"Blake" │30 │
29+└──┴───────────┴─────────┴────────────┴────────────────┘
30+TutorialD (master/main): :showdataframe s{status} orderby {status}
38+TutorialD (master/main): :showdataframe s{status} orderby {status descending} limit 1
44+TutorialD (master/main): :showdataframe s{status} orderby {status descending} offset 1 limit 3
53+The arrow in the attributes indicates the sort order while the DF column indicates the row number based on the sort order. Column ordering can also be arbitrary.