Skip to main content

sqrt

Function sqrt 

Source
pub fn sqrt<'a, V, E>(
    expr: E,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Double, <V::DialectMarker as DomainMathPolicy<E::Nullable>>::Nullable, E::Aggregate>
where V: SQLParam + 'a, V::DialectMarker: MathExt + DomainMathPolicy<E::Nullable>, E: Expr<'a, V>, E::SQLType: Numeric,
Expand description

SQRT - returns the square root of a number.

Returns a dialect-aware double type. SQLite and MySQL return NULL for a negative argument, while PostgreSQL reports an error.

ยงExample

use drizzle_core::expr::sqrt;

// SELECT SQRT(users.area)
let root = sqrt(users.area);