1# Project:M36 DataFrames
3Users 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.
5The equivalent feature in SQL is invoked by the `ORDER BY`, `LIMIT`, and `OFFSET` clauses.
9From 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>}
15The default sort order is `ascending`.
20TutorialD (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└──┴───────────┴─────────┴────────────┴────────────────┘
30TutorialD (master/main): :showdataframe s{status} orderby {status}
38TutorialD (master/main): :showdataframe s{status} orderby {status descending} limit 1
44TutorialD (master/main): :showdataframe s{status} orderby {status descending} offset 1 limit 3
53The 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.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list