Relation:update

Updates a column to the current relation based on an expression and a condition

Description

update name = expression where condition

Parameters

  • name: must be a valid name.
  • expression: any expression.
  • condition: any expression that evaluates to 1 or 0.

Examples

Using the sample relation films.csv

read "films.csv"
update film = upper(film) where director == "Godard"
print

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
Die verlorene Ehre der Katharina Blum von Trotta 1975
Der starke Ferdinand Kluge 1976
Sans toi ni loi Varda 1985

Comments

The expression can use any column of the current row and any global variable. It has not access to the other rows of the relation.

Variables can be numbers or text, it depends on the operators used in the expression. See expressions

The number of rows and the order stays the same.

See also

select extend