Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • SQL Server - Get Started
  • Install SQL Server
  • SQL Server Management Studio
  • SQL Server - Windows Authentication
  • SQL Server - Authentication
  • SQL Server - Create New User
  • SQL Server - GRANT/REVOKE Permissions to User
  • SQL Server - Data Types
  • SQL Server - Naming Conventions
  • SQL Server - CREATE Database
  • SQL Server - CREATE Table
  • Add Columns
  • Identity Column
  • Rename Column, Table
  • Drop Columns
  • SQL Server - Schema
  • SQL Server - Tables Relations
  • SQL Server - Primary Keys
  • Modify/Delete Primary Keys
  • SQL Server - Foreign Keys
  • Modify/Delete Foreign Keys
  • SQL Server - Check Constraints
  • SQL Server - Unique Constraints
  • SQL Server - Views
  • Modify/Delete Views
  • SQL Server - Functions
  • SQL Server - Stored Procedures
  • Stored Procedure Parameters
  • SQL Server - Indexes
  • Non-clustered Indexes
  • Modify/Delete Indexes
  • SQL Server - Triggers
  • DDL Triggers
  • LOGON Triggers
  • Enable/Disable Triggers
  • Modify/Delete Triggers
  • SQL Server - Sequence
  • SQL Server - Synonyms
  • SQL Server - IF ELSE Statement
  • SQL Server - Loops
  • SQL Server - Insert Data
  • SQL Server - Update Data
  • SQL Server - Delete Data
  • SQL Server - Select Query
  • WHERE Clause
  • GROUP BY Clause
  • HAVING Clause
  • ORDER BY Clause
  • SQL Server - Inner Join
  • Left Join
  • Right Join
  • Full Join
  • Self Join
  • Dynamic SQL
  • Built-in Functions
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

SQL Server FLOOR() Function

In SQL Server, the FLOOR() function returns the nearest integer that is less than or equal to the specified number or numeric expression.

The FLOOR() function is mainly used to round the floating-point value without fraction part from the floating point number value (decimal, double, float).

FLOOR(number)

Parameters

number: A valid numeric expression. The value of bit type is invalid.

Return Value

Returns the same type as the input expression.

Example 1:

The following example uses the FLOOR() function on the positive and negative numeric value.

Example: FLOOR()
SELECT FLOOR (23.34) AS PosInt, FLOOR (-23.34) AS NegInt;

In the above example, FLOOR(23.34) returns 23 because it is nearest and smallest integer value than 23.34. In the same way, FLOOR(-23.34) returns -24 because -24 is smaller than -23.34.

Example 2:

In the following example, zero and input less than one are passed as parameters to the FLOOR function.

Example: FLOOR()
SELECT FLOOR(0.01) AS PosInt, FLOOR(0.00) AS Result;

Example 3:

You can pass the numeric expression, as shown below.

Example: FLOOR() with Numeric Expression
SELECT FLOOR(1.6 * 2) AS Result;

Example 4:

The following example demonstrates the difference between the FLOOR() and the CEILING() functions.

Example: FLOOR()
SELECT FLOOR(23.34) AS FloorResult, CEILING(23.34) AS CeilingResult;

The following table lists difference between the CEILING() and the FLOOR() function for different input value:

Input ValueCEILING()FLOOR()
12.01212
12.21312
12.51312
12.123451312
-12.0-12-12
-12.2-12-13
-12.5-12-13
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.