Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:sql:functions:mod [2009/12/07 15:29]
tdo created
dev:sql:functions:mod [2016/06/28 22:38] (current)
Line 1: Line 1:
 {{page>:​top_add&​nofooter&​noeditbtn}} {{page>:​top_add&​nofooter&​noeditbtn}}
-<​html><​div align="​center"><​span style="​color:​red">​DRAFT</​span></​div></​html>​ 
-====== Omnidex SQL Function: $MOD ====== 
 {{page>:​sql_bar&​nofooter&​noeditbtn}} {{page>:​sql_bar&​nofooter&​noeditbtn}}
 +====== Omnidex SQL Function: MOD ======
 ===== Description ===== ===== Description =====
-Returns "modulus y". This is the remainder of divided by y.+Returns "modulus y". This is the integral ​remainder of divided by y.
  
-"​n"​ and "​y"​ may be a column , expression, or literal.+This function returns an INTEGER datatype.
  
-The return value is INTEGER length 4. 
 ===== Syntax ===== ===== Syntax =====
-  $MOD(<​column-spec|expression|constant>,<​column-spec|expression|constant>​) 
  
-== ==+  MOD( integral_expression,​ divisor_integral_expression ) 
 +   
 +  integral_expression % divisor_integral_expression 
 + 
 +== integral_expression ​==
    
-Required. This can be a column, expression, or constant.+Required. ​ Any expression that returns a integer-class datatype.  ​This value will be divided by the //​divisor_integral_expression//​.
  
-== ==+== divisor_integral_expression ​==
    
-Required. This can be a column, expression, or constant.+Required. ​ Any expression that returns a integer-class datatype.  ​This value will be divided into the //​integral_expression//​. 
 ===== Example ===== ===== Example =====
-==== Example 1 ==== +==== Example 1: Column using MOD ====
-select orders_year,​ $MOD(order_year,​ 4) from orders+
  
-ORDER_YEAR +<​code>​ 
---------------+> select population, mod(population,​ 100) from country_census;​
  
-$MOD(ORDERS.ORDER_YEAR,​4) +POPULATION ​             ​MOD(COUNTRY_CENSUS.POP 
---------------------------+---------------------- ​ ---------------------- 
 +              28846761 ​                     61 
 +              30007094 ​                     94 
 +             ​248709873 ​                     73 
 +             ​285230516 ​                     16
  
-2003+</​code>​
  
-3+==== Example 2: Column using % ====
  
-2002+<​code>​ 
 +> select population, population % 100 from country_census;​ 
 + 
 +POPULATION ​             POPULATION % 100 
 +---------------------- ​ ---------------------- 
 +              28846761 ​                     61 
 +              30007094 ​                     94 
 +             ​248709873 ​                     73 
 +             ​285230516 ​                     16 
 + 
 +</​code>​ 
 +====== Additional Resources ====== 
 + 
 +See also: 
 +{{page>​dev:​sql:​functions:​see_also_math&​noheader&​nofooter&​noeditbtn}}
  
-2 
  
-... 
 {{page>:​bottom_add&​nofooter&​noeditbtn}} {{page>:​bottom_add&​nofooter&​noeditbtn}}
 +
 
Back to top
dev/sql/functions/mod.1260199746.txt.gz · Last modified: 2016/06/28 22:38 (external edit)