This shows you the differences between two versions of the page.
dev:sql:functions:mod [2010/07/09 04:15] els |
dev:sql:functions:mod [2016/06/28 22:38] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{page>:top_add&nofooter&noeditbtn}} | ||
- | {{page>:sql_bar&nofooter&noeditbtn}} | ||
- | ====== Omnidex SQL Function: MOD ====== | ||
- | ===== Description ===== | ||
- | Returns "x modulus y". This is the integral remainder of x divided by y. | ||
- | This function returns an INTEGER datatype. | ||
- | |||
- | ===== Syntax ===== | ||
- | |||
- | MOD( integral_expression, divisor_integral_expression ) | ||
- | | ||
- | integral_expression % divisor_integral_expression | ||
- | |||
- | == integral_expression == | ||
- | |||
- | Required. Any expression that returns a integer-class datatype. This value will be divided by the //divisor_integral_expression//. | ||
- | |||
- | == divisor_integral_expression == | ||
- | |||
- | Required. Any expression that returns a integer-class datatype. This value will be divided into the //integral_expression//. | ||
- | |||
- | ===== Example ===== | ||
- | ==== Example 1: Column using MOD ==== | ||
- | |||
- | <code> | ||
- | > select population, mod(population, 100) from country_census; | ||
- | |||
- | POPULATION MOD(COUNTRY_CENSUS.POP | ||
- | ---------------------- ---------------------- | ||
- | 28846761 61 | ||
- | 30007094 94 | ||
- | 248709873 73 | ||
- | 285230516 16 | ||
- | |||
- | </code> | ||
- | |||
- | ==== Example 2: Column using % ==== | ||
- | |||
- | <code> | ||
- | > select population, population % 100 from country_census; | ||
- | |||
- | POPULATION POPULATION % 100 | ||
- | ---------------------- ---------------------- | ||
- | 28846761 61 | ||
- | 30007094 94 | ||
- | 248709873 73 | ||
- | 285230516 16 | ||
- | |||
- | </code> | ||
- | |||
- | {{page>:bottom_add&nofooter&noeditbtn}} | ||
- | |||
- | |||
- | {{page>:top_add&nofooter&noeditbtn}} | ||
- | {{page>:sql_bar&nofooter&noeditbtn}} | ||
- | ====== Omnidex SQL Function: ABS ====== | ||
- | ===== Description ===== | ||
- | The ABS function returns the absolute value of column. | ||
- | |||
- | This function returns the same datatype as the passed parameter. | ||
- | |||
- | ===== Syntax ===== | ||
- | |||
- | ABS( numeric_expression ) | ||
- | |||
- | == numeric_expression == | ||
- | |||
- | Required. Any expression that returns a numeric-class datatype. | ||
- | |||
- | ===== Examples ===== | ||
- | |||
- | === Example 1: Column === | ||
- | |||
- | <code> | ||
- | > select longitude, abs(longitude) from countries; | ||
- | |||
- | LONGITUDE ABS(LONGITUDE) | ||
- | -------------------------------- -------------------------------- | ||
- | -176.199997 176.199997 | ||
- | -175.000000 175.000000 | ||
- | -172.330002 172.330002 | ||
- | -171.750000 171.750000 | ||
- | -170.699997 170.699997 | ||
- | -170.000000 170.000000 | ||
- | -169.860001 169.860001 | ||
- | </code> | ||
- | |||
- | {{page>:bottom_add&nofooter&noeditbtn}} |