This is the eighteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation

Last time we saw tests for aggregates. Today we are going to implement expressions.

We can compare columns with different value types: numbers, dates, strings. However, it would be useful if we could first transform values in some manner, e.g., extract year part from date. This is the purpose of expressions. We already saw simple expressions working on rows when we were implementing comparing operators. Now let’s implement expressions working on columns:

We can see that expression works on row and source column. Let’s implement identity expression:

Now let’s implement first expression doing something more sophisticated:

We first extract cell and then calculate date part. In this manner we can implement other expressions:

Since we might want to chain expressions, let’s implement this;

And this is it. Next time we will test expressions.