VOOZH about

URL: https://www.geeksforgeeks.org/sql/sql-server-mathematical-functions-sqrt-pi-square-round-ceiling-floor/

⇱ SQL Server Mathematical Functions (SQRT, PI, SQUARE, ROUND, CEILING & FLOOR) - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

SQL Server Mathematical Functions (SQRT, PI, SQUARE, ROUND, CEILING & FLOOR)

Last Updated : 17 Jun, 2024

SQL Server mathematical functions are used to perform mathematical calculations. These functions are designed to simplify complex calculations and make it easier to analyze and manipulate data.

Here, we will cover the syntax and examples of various mathematical functions like SQRT(), PI(), SQUARE(), and many more

Mathematical Functions in SQL Server

Some commonly used mathematical functions are given below:

List of Mathematical Functions in SQL Server with Syntax

FunctionDescriptionSyntax
SQRT()Returns the square root of a numeric value.SELECT SQRT(..value..)
PI()Returns the value of pi (3.14159265358979).SELECT PI()
SQUARE()Returns the square of a numeric value.SELECT SQUARE(..value..)
ROUND()Rounds a numeric value to the specified number of decimal places.SELECT ROUND(..value.., number_of_decimal_places)
CEILING()Returns the smallest integer greater than or equal to a numeric value.SELECT CEILING(..value..)
FLOOR()Returns the largest integer less than or equal to a numeric value.SELECT FLOOR(..value..)

SQL Server Mathematical Functions Examples

Let's look at some examples of the mentioned mathematical functions in SQL Server.

SQRT() Function Example

👁 SQRT() Function Example

PI() Function Example

👁 PI() Function Example

SQUARE() Function Example

👁 SQUARE() Function Example

ROUND() Function Example

👁 ROUND() Function Example

CEILING() and FLOOR() Function Example

👁 CEILING() and FLOOR() Function Example
Comment
Article Tags:
Article Tags: