Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Floor Function In Sql in SQL

Floor Function In Sql in SQL

? FLOOR() Function in SQL

The FLOOR() function returns the largest integer less than or equal to a given numeric value.


? Syntax:

FLOOR(number)
  • number: A numeric value (can be decimal or negative).


? Examples:

SELECT FLOOR(15.9);     -- Returns 15SELECT FLOOR(15.1);     -- Returns 15SELECT FLOOR(-3.7);     -- Returns -4SELECT FLOOR(100);      -- Returns 100

? Use Cases:

Use CaseExample
Round down pricesFLOOR(price)
Pagination calculationsFLOOR(total_rows / rows_per_page)
Time rounding (to hours)FLOOR(minutes / 60)

? Compare with Other Rounding Functions:

FunctionDescriptionExample (-2.3)
FLOOR()Round down to nearest integer-3
CEIL()Round up to nearest integer-2
ROUND()Round to nearest integer or decimal places-2
TRUNCATE()Trims to specified decimal places-2.3 or -2

Let me know if you’d like examples with tables or used in real-world scenarios like tax or billing calculations.

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql