Relation:Tutorial 9
Preparing output
For the relational theory, rows and columns are not in a particular order. For humans, this may not be as readable.
Therefore, you can use order, limit, project and format to make a pretty output.
Order films by director and title
director | film | year |
---|---|---|
Godard | A bout de souffle | 1960 |
Godard | Pierrot le fou | 1965 |
Godard | Week-End | 1967 |
Kluge | Der starke Ferdinand | 1976 |
Truffaut | Jules et Jim | 1962 |
Truffaut | Tirez sur le pianiste | 1960 |
Varda | Cléo de 5 à 7 | 1962 |
Varda | Sans toi ni loi | 1985 |
von Trotta | Die verlorene Ehre der Katharina Blum | 1975 |
Order films by year and only the 3 newest
year | film | director |
---|---|---|
1985 | Sans toi ni loi | Varda |
1976 | Der starke Ferdinand | Kluge |
1975 | Die verlorene Ehre der Katharina Blum | von Trotta |
There are qualifiers to order: a z A Z 1 9. Try them out
Limit has a start and a length value. If it is negative, it will take the last rows
Show average of films by director with 2 decimal values
film_count_avg |
---|
1.80 |
You now have learned the basics. To go further and deeper, read the following pages:
' ====Preparing output====
' For the relational theorie, rows and columns are not in a particular order. For humans, this may not be as readable.
' Therefore, you can use [[order]], [[limit]], [[project]] and [[format]] to make a pretty output.
' '''''Order films by director and title'''''
read "films.csv"
order director, film
project director, film, year
' '''''Order films by year and only the 3 newest'''''
read "films.csv"
order year 9
limit 1 3
project year, film, director
' There are qualifiers to order: a z A Z 1 9. Try them out
' Limit has a start and a length value. If it is negative, it will take the last rows
' '''''Show average of films by director with 2 decimal values'''''
read "films.csv"
project director, film count
project film_count avg
format film_count_avg "%1.2f"
' You now have learned the basics. To go further and deeper, read the following pages:
' * [[Expressions]]
' * [[Instructions]]