Protocol
SQLSubqueryClauseBuilder
SELECT query. Useful for building CTEs, CREATE TABLE ... SELECT clauses, etc., not to mention actual SELECT queries.protocol SQLSubqueryClauseBuilder : SQLAliasedColumnListBuilder, SQLCommonTableExpressionBuilder, SQLJoinBuilder, SQLPartialResultBuilder, SQLPredicateBuilder, SQLSecondaryPredicateBuilder
Overview
Due to unfortunate naming choices which this API is now stuck with until a major version bump, this protocol is very easily confused with SQLSubqueryBuilder. For clarification, this protocol provides methods common to the construction of SELECT subqueries, whereas SQLSubqueryBuilder is a concrete type which conforms to this protocol and provides support for embedding SQLSubquery expressions in other queries.
Important
Despite the use of the term “subquery”, this builder does not provide methods for specifying subquery operators (e.g. ANY, SOME), nor does it enclose its result in grouping parenthesis, as all of these formations are context-specific and are the purview of builders that conform to this protocol.
Note
The primary motivation for the existence of this protocol is to make it easier to construct SELECT queries without specifying a database or providing the SQLQueryBuilder and SQLQueryFetcher methods in inappropriate contexts.
Topics
Instance Properties
var select: SQLSelectTheSQLSelectquery under construction.
Instance Methods
func distinct() -> SelfAdds aDISTINCTclause to the query.func distinct(on: [any SQLExpression]) -> SelfAdds aDISTINCTclause to the select statement and explicitly specifies columns to select, overwriting any previously specified columns.func distinct(on:_:)Adds aDISTINCTclause to the select statement and explicitly specifies columns to select, overwriting any previously specified columns.func `for`(SQLLockingClause) -> SelfAdds a locking clause to this query. If called more than once, the last call wins.func from(_:)Include the given table in the list of those used by the query, without performing an explicit join.func from(_:as:)Include the given table and an alias for it in the list of those used by the query, without performing an explicit join.func groupBy(_:)Adds aGROUP BYclause to the query with the specified column.func lockingClause(any SQLExpression) -> SelfAdds a locking clause to this query. If called more than once, the last call wins.
Relationships
Inherits From
SQLAliasedColumnListBuilderSQLCommonTableExpressionBuilderSQLJoinBuilderSQLPartialResultBuilderSQLPredicateBuilderSQLSecondaryPredicateBuilderSQLUnqualifiedColumnListBuilder
Conforming Types
See Also
Builder Protocols
protocol SQLAliasedColumnListBuilderCommon definitions for query builders which permit specifying aliased column names.protocol SQLColumnUpdateBuilderCommon definitions for query builders which support assigning values to columns.protocol SQLCommonTableExpressionBuilderCommon definitions for query builders which support Common Table Expressions.protocol SQLCommonUnionBuilderprotocol SQLJoinBuilderCommon definitions for any query builder which permits specifying joins.protocol SQLPartialResultBuilderCommon definitions for any query builder which permits specifying range and ordering behaviors.protocol SQLPredicateBuilderCommon definitions for any query builder which permits specifying a primary predicate.protocol SQLQueryBuilderBase definitions for builders which set up queries and execute them against a given database.protocol SQLQueryFetcherCommon definitions forSQLQueryBuilders which support retrieving result rows.protocol SQLReturningBuilderCommon definitions for any query builder which can return values from data-mutating queries.protocol SQLSecondaryPredicateBuilderCommon definitions for any query builder which permits specifying a secondary predicate.protocol SQLUnqualifiedColumnListBuilderCommon definitions for query builders which permit or require specifying a list of unqualified column names.