-
The table to select rows from.
Declaration
Swift
public let tables: [Table] -
The SQL WHERE clause containing the filter for rows to retrieve. Could be represented with a
Filterclause or aStringcontaining raw SQL.Declaration
Swift
public private(set) var whereClause: QueryFilterProtocol? { get } -
A boolean indicating whether the selected values have to be distinct. If true, corresponds to the SQL SELECT DISTINCT statement.
Declaration
Swift
public private(set) var distinct: Bool { get } -
The number of rows to select. If specified, corresponds to the SQL SELECT TOP/LIMIT clause.
Declaration
Swift
public private(set) var rowsToReturn: Int? { get } -
The number of rows to skip. If specified, corresponds to the SQL SELECT OFFSET clause.
Declaration
Swift
public private(set) var offset: Int? { get } -
The SQL HAVING clause containing the filter for the rows to select when aggregate functions are used. Could be represented with a
Havingclause or aStringcontaining raw SQL.Declaration
Swift
public private(set) var havingClause: QueryHavingProtocol? { get } -
The SQL UNION clauses.
Declaration
Swift
public private(set) var unions: [Union]? { get } -
The SQL JOIN, ON and USING clauses. ON clause can be represented as
Filteror aStringcontaining raw SQL. USING clause: an array ofColumnelements that have to match in a JOIN query.Declaration
Swift
public private(set) var joins: [(join: Join, on: QueryFilterProtocol?, using: [Column]?)] { get } -
An array of
AuxiliaryTablewhich will be used in a query with a WITH clause.Declaration
Swift
public private(set) var with: [AuxiliaryTable]? { get } -
Build the query using
QueryBuilder.Throws
QueryError.syntaxError if query build fails.Declaration
Swift
public func build(queryBuilder: QueryBuilder) throws -> StringParameters
queryBuilderThe QueryBuilder to use.
Return Value
A String representation of the query.
-
Add the HAVING clause to the query.
Declaration
Swift
public func having(_ clause: QueryHavingProtocol) -> SelectParameters
clauseThe
Havingclause or aStringcontaining SQL HAVING clause to apply.Return Value
A new instance of Select with the
Havingclause. -
Add the LIMIT/TOP clause to the query.
Declaration
Swift
public func limit(to newLimit: Int) -> SelectParameters
toThe limit of the number of rows to select.
Return Value
A new instance of Select with the LIMIT clause.
-
Add the OFFSET clause to the query.
Declaration
Swift
public func offset(_ offset: Int) -> SelectParameters
toThe number of rows to skip.
Return Value
A new instance of Select with the OFFSET clause.
-
Add an SQL WHERE clause to the select statement.
Declaration
Swift
public func `where`(_ conditions: QueryFilterProtocol) -> SelectParameters
conditionsThe
Filterclause or aStringcontaining SQL WHERE clause to apply.Return Value
A new instance of Select with the WHERE clause.
-
Add an SQL ON clause to the JOIN statement.
Declaration
Swift
public func on(_ conditions: QueryFilterProtocol) -> SelectParameters
conditionsThe
Filterclause or aStringcontaining SQL ON clause to apply.Return Value
A new instance of Select with the ON clause.
-
Create an SQL SELECT UNION statement.
Declaration
Swift
public func union(_ query: Select) -> SelectParameters
tableThe second Select query used in performing the union.
Return Value
A new instance of Select corresponding to the SELECT UNION.
-
Create an SQL SELECT UNION ALL statement.
Declaration
Swift
public func unionAll(_ query: Select) -> SelectParameters
tableThe second Select query used in performing the union.
Return Value
A new instance of Select corresponding to the SELECT UNION ALL.
-
Create an SQL SELECT INNER JOIN statement.
Declaration
Swift
public func join(_ table: Table) -> SelectParameters
tableThe right table used in performing the join. The left table is the table field of this
Selectinstance.Return Value
A new instance of Select corresponding to the SELECT INNER JOIN.
-
Create an SQL SELECT LEFT JOIN statement.
Declaration
Swift
public func leftJoin(_ table: Table) -> SelectParameters
tableThe right table used in performing the join. The left table is the table field of this
Selectinstance.Return Value
A new instance of Select corresponding to the SELECT LEFT JOIN.
-
Create an SQL SELECT CROSS JOIN statement.
Declaration
Swift
public func crossJoin(_ table: Table) -> SelectParameters
tableThe right table used in performing the join. The left table is the table field of this
Selectinstance.Return Value
A new instance of Select corresponding to the SELECT CROSS JOIN.
-
Create an SQL SELECT NATURAL JOIN statement.
Declaration
Swift
public func naturalJoin(_ table: Table) -> SelectParameters
tableThe right table used in performing the join. The left table is the table field of this
Selectinstance.Return Value
A new instance of Select corresponding to the SELECT NATURAL JOIN.
-
Create a join statement with the type of join specified in the String.
Declaration
Swift
public func rawJoin(_ raw: String, _ table: Table) -> SelectParameters
rawA String containg a join to apply.
tableThe right table used in performing the join. The left table is the table field of this
Selectinstance.Return Value
A new instance of Select corresponding to the join.
View on GitHub
Select Structure Reference