% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/translate-sql-aggregate.R
\name{sql_translation_agg}
\alias{sql_translation_agg}
\alias{sql_aggregate}
\alias{sql_aggregate_2}
\alias{sql_aggregate_n}
\alias{sql_check_na_rm}
\alias{sql_not_supported}
\title{SQL helpers for aggregate functions}
\usage{
sql_aggregate(f, f_r = f)

sql_aggregate_2(f)

sql_aggregate_n(f, f_r = f)

sql_check_na_rm(na.rm)

sql_not_supported(f)
}
\arguments{
\item{f}{The name of the SQL function as a string.}

\item{f_r}{The name of the R function being translated as a string.}

\item{na.rm}{Logical indicating whether missing values should be removed.
In SQL, missing values are always removed in aggregate functions, so this
function will warn if \code{na.rm} is not \code{TRUE}.}
}
\description{
These functions help you create custom aggregate SQL translations when
implementing a new backend. They are typically used within \code{\link[=sql_translator]{sql_translator()}}
to define how R aggregate functions should be translated to SQL.
\itemize{
\item \code{sql_aggregate()} creates a SQL aggregate function translator for functions
with a single argument and an optional \code{na.rm} parameter (e.g., \code{SUM()},
\code{AVG()}).
\item \code{sql_aggregate_2()} creates a SQL aggregate function translator for
functions with exactly two arguments (e.g., \code{CORR()}, \code{COVAR_SAMP()}).
\item \code{sql_aggregate_n()} creates a SQL aggregate function translator for
functions with any number of arguments and an optional \code{na.rm} parameter
(e.g., \code{LEAST()}, \code{GREATEST()}).
\item \code{sql_not_supported()} creates a function that throws an informative error
when a function is not supported in SQL.
\item \code{sql_check_na_rm()} is a helper that you can use in aggregate functions
to direct the user towards setting \code{na.rm = TRUE}.
}
}
\seealso{
Other SQL translation helpers:
\code{\link{sql_translation_scalar}},
\code{\link{sql_translation_string}},
\code{\link{sql_translation_window}},
\code{\link[=sql_variant]{sql_variant()}}
}
\concept{SQL translation helpers}
