AS
Creates an alias for a column using SQL AS.
This infix function allows you to assign a temporary, more readable name to a column. This is particularly useful in SELECT statements, especially with aggregate functions or complex expressions.
Example
Employees.select(Employees.firstName AS "user_name")Return
A new KQLiteColumn instance representing the column with its alias.
Author
MOHAMMAD AZIM ANSARI
Parameters
The alias String to assign to the column.
Creates an alias for a table using SQL AS.
This infix function allows you to assign a temporary name to a table. This is essential for self-joins or when you need to reference the same table multiple times with different roles in a single query.
Example
val m = Employees AS "m"
val e = Employees AS "e"
val manager = m[Employees.firstName].CONCAT(" ").CONCAT(m[Employees.lastName]) AS "Manager"
val directReport =
(e[Employees.firstName].CONCAT(" ").CONCAT(e[Employees.lastName])) AS "Direct report"
val cursor =
e
.select(
manager,
directReport,
).join(m, JoinType.INNER_JOIN)
.on(m[Employees.employeeId], e[Employees.reportsTo])
.where {
LENGTH(manager) GT 4
}.orderBy(manager)
.execute()Return
An AliasTable instance representing the table with its alias.
Author
MOHAMMAD AZIM ANSARI
Parameters
The alias String to assign to the table.
Creates an alias for a subquery (a SELECT statement) using SQL AS.
This infix function allows you to assign a temporary name to the result set of a SELECT statement, enabling it to be used as a table in a larger query (e.g., in a FROM or JOIN clause).
Example
Employees
.update {
it.employeeId.bind(1)
it.firstName.bind("name")
it.birthDate.bind(Report.date)
}.from {
Report
.select(Report.date)
.where {
Report.date GT DateLiteral("2023-01-01")
} AS "Reports"
}.execute()Return
The same SelectStatement instance, now configured with the specified alias.
Author
MOHAMMAD AZIM ANSARI
Parameters
The alias String to assign to the subquery.