Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Math FunctionsRSS Feeds

SQUARE Function

Posted By: Sarita Patel     Category: SQL Server     Views: 5516

This article explains SQUARE function of sql server with examples.

SQUARE function is used to calculate square of specified number.


Syntax of SQUARE Function :

SQUARE (float_expression)

float_expression is a numeric value of type float.

Return type of SQUARE function is float.



Examples of SQUARE Function :

Example 1 : Use of SQUARE function in select clause

SELECT SQUARE(5)

Output
25

Above example returns square of specified numeric value 5.



Example 2 : Use of SQUARE function in where clause

SELECT ProductName, UnitPrice
FROM    Products
WHERE  SQUARE(UnitPrice)  >  500

Output
ProductName                                 UnitPrice
Grandma's Boysenberry Spread      25.00
Uncle Bob's Organic Dried Pears      30.00
Northwoods Cranberry Sauce         40.00
Mishi Kobe Niku                             97.00
Ikura                                            31.00
Queso Manchego La Pastora           38.00

Above example displays all products having square of unit price greater than 500.
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on SQUARE Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of SQUARE Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!