final class TableQuery
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The query of CREATE TABLE ... SELECT, with the handling of rows that duplicate a unique key.

The rows of the query fill the new table. IGNORE discards a row that duplicates a unique key value, REPLACE replaces the old row; without either such a row is an error. The word AS before the query is optional and changes nothing. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table-select.html.

Reading the query partdoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t IGNORE AS SELECT 1 AS a');
    $create->statement->query->duplicate // => \SqlSemantics\Platform\MySql\Statement\Dml\DuplicateHandling::Ignore

Properties§

public Query $query
public DuplicateHandling|null $duplicate = null

Methods§

public function __construct(
    public Query $query,
    public DuplicateHandling|null $duplicate = null,
)

Parameters

$queryQueryThe query whose rows fill the table
$duplicateDuplicateHandling|nullIGNORE or REPLACE, when written
public function render(Output $out): void

Writes the duplicate handling and the query.

Parameters

$outOutput
Calls 1

Test cases 3§

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

Dedicated tests 1
Other tests reaching this symbol 2

Relations§

Instantiated in 4
Type declarations 4