sql.join: Join 'dbi.table's

View source: R/sql.join.R

sql.joinR Documentation

Join dbi.tables

Description

A SQL-like join of two dbi.tables that share the same DBI connection. All columns from both dbi.tables are returned.

Usage

sql.join(x, y, type = "inner", on = NULL, prefixes = c("x.", "y."))

Arguments

x, y

dbi.tables to join. x and y must share the same DBI connection.

type

a character string specifying the join type. Valid choices are "inner", "left", "right", "outer", and "cross".

on

a call specifying the join predicate. The symbols in on should be column names of x or column names of y, use prefixes as necessary.

prefixes

a 2-element character vector of distinct values. When x and y both have a column with the same name (e.g., common_name) then, when specifing the join predicate in on, use `prefixes[1]`common_name to refer to the common_name column in x and `prefixes[2]`common_name to refer to the common_name column in y. prefixes are also used to disambiguate the output column names.

Value

a dbi.table.

Examples

chinook <- dbi.catalog(chinook.duckdb)
Album <- chinook$main$Album
Artist <- chinook$main$Artist

sql.join(Album, Artist, type = "inner",
         on = Album.ArtistId == Artist.ArtistId,
         prefixes = c("Album.", "Artist."))


dbi.table documentation built on April 3, 2025, 7:40 p.m.