Calculated Fields

SELECT
    Name,
    COALESCE(LifeExpectancy, 100) LifeExpectancy
FROM country


Name LifeExpectancy
Aruba 78.4
Afghanistan 45.9
Angola 38.3
Anguilla 76.1
Albania 71.6
Andorra 83.5
Netherlands Antilles 74.7
United Arab Emirates 74.1
Argentina 75.1
Armenia 66.4
...

In the example, the average life expectancy in each country is selected. If there is no data, the value is set to 100 years.

COALESCE(expression1, expression2, ..., expressionN)

The function returns the first non-empty value from the list of arguments. If all arguments are NULL, returns NULL.

expression1, expression2, ..., expressionN are expressions that are checked sequentially until a non-empty value is found.