SQLSubqueryable

public protocol SQLSubqueryable : SQLSpecificExpressible

The protocol for types that can be embedded as a subquery.

SQLSubqueryable

  • sqlExpression Extension method

    Returns a subquery expression.

    Declaration

    Swift

    public var sqlExpression: SQLExpression { get }
  • contains(_:) Extension method

    Returns an expression that checks the inclusion of the expression in the subquery.

    // 1000 IN (SELECT score FROM player)
    let request = Player.select(Column("score"), as: Int.self)
    let condition = request.contains(1000)
    

    Declaration

    Swift

    public func contains(_ element: SQLExpressible) -> SQLExpression
  • exists() Extension method

    Returns an expression that is true if and only if the subquery would return one or more rows.

    // EXISTS (SELECT * FROM player WHERE name = 'Arthur')
    let request = Player.filter(Column("name") == "Arthur")
    let condition = request.exists()
    

    Declaration

    Swift

    public func exists() -> SQLExpression