Converting NULLs in relational algebra -


i have table result of outer join, want sum on attribute tuples null in attribute. how 1 go converting null appropriate value (in case 0)?

the book i'm reading doesn't dwell on null type in relational algebra, i'm going assume aggregate functions doesn't try "right thing" , interpret null unit.

in relational data model, null value not ordinary value, , not converted particular value according different operators.

sum, other aggregate operators, ignore null values, in fact summing column null values equivalent sum non-null value, , is, obiously, equivalent treat null 0. in same way, if try calculate average of numeric column, non-null values summed , total divided number of non-null values (not values).

on other hand, if want consider null value in special way operation, can check , substitute value interested in.

for instance, following sql query calculates avg of non-null values of column:

select avg(column) table 

while next 1 calculates avg considering null values 0 (and giving result different previous one):

select avg(case when column null 0 else column end)  table 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -