Relation:Tutorial 4
Selection
Selection filters the table by rows. It evaluates an expression for each row and keeps it if the result of the expression is true.
We reuse the table films.csv
Look at the code on the right and compare with the result,
Select all films by Godard
film | director | year |
---|---|---|
A bout de souffle | Godard | 1960 |
Pierrot le fou | Godard | 1965 |
Week-End | Godard | 1967 |
Select all from 1962
film | director | year |
---|---|---|
Cléo de 5 à 7 | Varda | 1962 |
Jules et Jim | Truffaut | 1962 |
The comparison operators depend on wether the column should be considered as number or as text
If you want to compare numbers, use = != < <= >= >
If you want to compare text, use == !== << <== >== >>
Select the films of the sixties with a title shorter than 10 charactes
film | director | year |
---|---|---|
Week-End | Godard | 1967 |
In expressions, you can use logical operators and or xor not algebraic functions, functions and paranthesies, if you need.
Go to Tutorial 5
' ===Selection===
' Selection filters the table by rows. It evaluates an expression for each row and keeps it if the result of the expression is true.
' We reuse the table [[Media:films.csv]]
' Look at the code on the right and compare with the result
' '''''Select all films by Godard'''''
read "films.csv"
select director == "Godard"
' '''''Select all from 1962'''''
read "films.csv"
select year = 1962
' The comparison operators depend on wether the column should be considered as number or as text
' If you want to compare numbers, use = != < <= >= >
' If you want to compare text, use == !== << <== >== >>
' '''''Select the films of the sixties with a title shorter than 10 charactes'''''
read "films.csv"
select year >= 1960 and year <= 1969 and length(film) < 10
' In expressions, you can use logical operators and or xor not algebraic functions, [[functions]] and paranthesies, if you need.
' Go to [[Tutorial 5]]