![]() | |
#41
| |||
| |||
|
|
Probably better would be to define a new type, 'quantity', and make the "number of people" an attribute of this 'quantity' type. |
|
You could then define your functions that perform summing operations to only accept this 'quantity' type for the values to sum. |
#42
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#43
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#44
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#45
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#46
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#47
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#48
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#49
| |||
| |||
|
|
Ben Finney wrote: Zhang Weiwu <zhangweiwu (AT) realss (DOT) com> writes: I have a db table for all fields used in a calculation. id field_name ------------- 01 Telephone Number 02 Number of Children .. ... Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number of children so you know how many children in total are there, but it doesn't make sense to sum up telephone number. The example of a telephone number is easily solved for this case: don't make telephone numbers as numeric types. There are no numeric operations that make sense on telephone numbers, so store them as a text type or some more-specific type, not numeric. Hi. Maybe I didn't use the best example. So I give an alternative example: id field_name ------------- 01 Age 02 Number of Children In reality few would like to calculate the sum of ages of a group of people, but they do have the interest to calculate how many children they have. A more vivid example even closer to our context: 03 The level of your satisfaction to the government's reaction to the earth quick in SiChuan, please describe using scale from 1 to 5. 04 The death number in your family in this earth quake Some people might be interested to see the average satisfaction level from 1-5 on a county-scale, but they don't have interest to see the sum (because the sum of satisfaction level doesn't reflect any meaningful figure). But, everybody wish to know the sum of death on a county scale, if every family answered the question. Thanks! |
#50
| |||
| |||
|
|
Now I wish to add a column of a boolean value to represent if it makes sense to sum up this field. let's say, it makes sense to sum up number |
![]() |
| Thread Tools | |
| Display Modes | |
| |