StmtJoin: SQL JOIN statement.

StmtJoinR Documentation

SQL JOIN statement.

Description

SQL JOIN statement.

SQL JOIN statement.

Details

This class represents a SQL JOIN statement. It requires two fields on which to join, and the type of join to perform (inner, left, right, or full). The table on which to join is determined by looking at the two fields in order and using the first table name available.

Super class

sqlq::Statement -> StmtJoin

Methods

Public methods

Inherited methods

Method new()

Initializer. To determine the table on which to join, we look at the both fields in order and use the first table name available.

Usage
StmtJoin$new(field1, field2, type = c("inner", "left", "right", "full"))
Arguments
field1

The first field on which to join.

field2

The second field on which to join.

type

The type of join to perform. One of "inner", "left", "right", or "full". Defaults to "inner".

Returns

Nothing.


Method getTokens()

Generates the list of tokens representing this statement.

Usage
StmtJoin$getTokens()
Returns

A list of Token objects.


Method clone()

The objects of this class are cloneable with this method.

Usage
StmtJoin$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# Create an inner join (default join type) between table 'foo' and table
# 'bar':
join <- StmtJoin$new(ExprField$new("id", "foo"),
                     ExprField$new("foo_id", "bar"))

# Create a left join between table 'foo' and table 'bar':
join <- StmtJoin$new(ExprField$new("id", "foo"),
                     ExprField$new("foo_id", "bar"),
                     type = "left")


sqlq documentation built on Sept. 16, 2025, 9:10 a.m.