Reference > Functions > Mathematical
Sin
- 2005
- 2008
- 2012
- 2014
- 2016
- 2017
- 2019
- 2022
- 2005, 2008, 2012, 2014, 2016, 2017, 2019, 2022
Sin (Sine) Mathematical Function
Use the Sin
function to return the sine of the specified expression.
Syntax
db.fx.Sin({expression})
Arguments
- expression
- – The value to use in the sine calculation.
Returns
float
Examples
Select Statement
Select the sine of a product's weight (which is nullable in the database).
float? result = db.SelectOne(
db.fx.Sin(dbo.Product.Weight)
)
.From(dbo.Product)
.Execute();
Where Clause
Select the sine of a product's depth (which is nullable in the database) where the depth is greater than 0 and less than 1.
IEnumerable<float?> result = db.SelectMany(
db.fx.Sin(dbo.Product.Depth)
)
.From(dbo.Product)
.Where(dbo.Product.Depth > 0 & dbo.Product.Depth < 1)
.Execute();
Order By Clause
Select and order by the sine of a product's depth.
IEnumerable<Product> result = db.SelectMany<Product>()
.From(dbo.Product)
.OrderBy(db.fx.Sin(dbo.Product.Depth).Desc())
.Execute();
Group By Clause
Select product details grouped by product category and sine of the product's depth.
IEnumerable<dynamic> results = db.SelectMany(
dbo.Product.ProductCategoryType,
db.fx.Sin(dbo.Product.Depth).As("calculated_value")
)
.From(dbo.Product)
.GroupBy(
dbo.Product.ProductCategoryType,
db.fx.Sin(dbo.Product.Depth)
)
.Execute();
Having Clause
Select the ids of all products, grouped by product category type having an sine of the product's height greater than 1.
IEnumerable<ProductCategoryType?> results = db.SelectMany(
dbo.Product.ProductCategoryType
)
.From(dbo.Product)
.Where(dbo.Product.Height > 0 & dbo.Product.Height < 1)
.GroupBy(
dbo.Product.ProductCategoryType,
db.fx.Sin(dbo.Product.Height)
)
.Having(
db.fx.Sin(dbo.Product.Height) < .5f
)
.Execute();