Reference > Functions > Mathematical

Exp

  • 2005, 2008, 2012, 2014, 2016, 2017, 2019, 2022

Exp (Exponential) Mathematical Function

Use the Exp function to return the exponential of the specified expression.

Syntax

db.fx.Exp({expression})

Arguments

expression
The value to use in the exponential calculation.

Returns

float

Examples

Select Statement

Select the exponential of a product's weight (which is nullable in the database).

float? result = db.SelectOne(
        db.fx.Exp(dbo.Product.Weight)
    )
    .From(dbo.Product)
    .Execute();

Where Clause

Select the exponential of a product's depth (which is nullable in the database).

float? result = db.SelectOne(
        db.fx.Exp(dbo.Product.Depth)
    )
    .From(dbo.Product)
    .Execute();

Order By Clause

Select and order by the exponential of a product's depth.

IEnumerable<Product> result = db.SelectMany<Product>()
    .From(dbo.Product)
    .OrderBy(db.fx.Exp(dbo.Product.Depth).Desc())
    .Execute();

Group By Clause

Select product details grouped by product category and the exponential of the product's depth.

IEnumerable<dynamic> results = db.SelectMany(
        dbo.Product.ProductCategoryType,
        db.fx.Exp(dbo.Product.Depth).As("calculated_value")
    )
    .From(dbo.Product)
    .GroupBy(
        dbo.Product.ProductCategoryType,
        db.fx.Exp(dbo.Product.Depth)
    )
    .Execute();

Having Clause

Select the ids of all products, grouped by product category type having a exponential of the product's height greater than the product's width.

IEnumerable<ProductCategoryType?> results = db.SelectMany(
        dbo.Product.ProductCategoryType
    )
    .From(dbo.Product)
    .GroupBy(
        dbo.Product.ProductCategoryType,
        db.fx.Exp(dbo.Product.Height),
        dbo.Product.Width
    )
    .Having(
        db.fx.Exp(dbo.Product.Height) > dbo.Product.Width
    )
    .Execute();
Previous
Cot

© 2024 dbExpression. All rights reserved.