Difference between revisions of "FLOOR"

From SQLZOO
Jump to: navigation, search
Line 29: Line 29:
 
<ul>
 
<ul>
 
   <li>[[ROUND |ROUND function]]</li>
 
   <li>[[ROUND |ROUND function]]</li>
   <li>[[CEIL function]]</li>
+
   <li>[[CEIL |CEIL function]]</li>
 
   <li>[[MOD |MOD function]]</li>
 
   <li>[[MOD |MOD function]]</li>
 
</ul>
 
</ul>

Revision as of 11:07, 16 July 2012

Compatibility
FLOOR(f)
EngineOKAlternative
ingresYes
mysqlYes
oracleYes
postgresYes
sqlserverYes

FLOOR

FLOOR(f) returns the integer value of f

FLOOR(f) give the integer that is equal to, or just less than f. FLOOR always rounds down.

  FLOOR(2.7) ->  2
  FLOOR(-2.7) -> -3

In this example we calculate the population in millions.

SELECT name,
       FLOOR(population/1000000)
  FROM bbc

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense