Relation:select
Selects columns of the current relation based on an expression.
Description
select expression
Parameters
- expression: result must be 1 (true) to keep a row in the relation.
Examples
Using the sample relation films.csv
read "films.csv"
select director == "Godard"
| film | director | year |
|---|---|---|
| A bout de souffle | Godard | 1960 |
| Pierrot le fou | Godard | 1965 |
| Week-End | Godard | 1967 |
read "films.csv"
select year < 1970
| film | director | year |
|---|---|---|
| A bout de souffle | Godard | 1960 |
| Tirez sur le pianiste | Truffaut | 1960 |
| Cléo de 5 à 7 | Varda | 1962 |
| Jules et Jim | Truffaut | 1962 |
| Pierrot le fou | Godard | 1965 |
| Week-End | Godard | 1967 |
read "films.csv"
select year < 1970 and director == "Varda"
| film | director | year |
|---|---|---|
| Cléo de 5 à 7 | Varda | 1962 |
read "films.csv"
select film regex "\sle\s"
| film | director | year |
|---|---|---|
| Tirez sur le pianiste | Truffaut | 1960 |
| Pierrot le fou | Godard | 1965 |
read "films.csv"
select 0
| film | director | year |
|---|
Comments
Note that text comparison uses not the same operators as numbers. See expressions for operator list.
The number of columns and the order stays the same.
