final class Joining
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Combines the two operands of a join: merged columns, the order * selects and NULL extension.

Rule: MYSQL-JOIN-COLUMNS-001. A LEFT join can extend the rows of its right operand with NULLs and a RIGHT join those of its left operand; the columns of an extended operand can be NULL in the occurrence and keep their declaration. Each column named by USING, and for a NATURAL join each column name both operands select with *, is merged: an unqualified name and * see one column, the column of the left operand, or of the right operand for a RIGHT join, which is the value COALESCE of both yields there; a qualified name still reaches the column of either operand. * selects the merged columns first, in the order of the operand they are taken from, then the other columns of that operand, then those of the other operand (a RIGHT join is read as the LEFT join of its swapped operands). A USING column that an operand certainly lacks, or selects twice, is reported. The common columns of a NATURAL join are not known while an operand has undeclared columns, so nothing is merged then. Source: https://dev.mysql.com/doc/refman/8.4/en/join.html ("Natural joins and joins with USING, including outer join variants, are processed according to the SQL:2003 standard"). Status: Implemented.

Methods§

public function join(
    Derivation $derivation,
    JoinedInput $left,
    JoinedInput $right,
    JoinedTable $join,
): JoinedInput

Joins the right operand to the left one.

Parameters

Called from 1
Calls 7
public function names(
    Derivation $derivation,
    JoinedTable $join,
    JoinedInput $left,
    JoinedInput $right,
): list<Name>

Answers the names of the merged columns: the USING list, or for a natural join the names both operands select, in the order of the operand they are taken from.

Parameters

Returns

list<Name>
Called from 1
Calls 1
public function locate(
    Derivation $derivation,
    array<int, VisibleRelation> $visible,
    list<array{int, int}> $star,
    Name $name,
    JoinedInput $operand,
): ?int

Finds the star entry of an operand that a merged name denotes, reporting a name that is missing or selected twice.

Parameters

$derivationDerivation
$visiblearray<int, VisibleRelation>
$starlist<array{int, int}>The star entries of the operand
$nameName
$operandJoinedInput

Returns

?int
Called from 2
Calls 6

Test cases 3§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3

Relations§

Instantiated in 2
Method calls 2