Go back
use MichaelRushton\Database\SQL\Components\Table;
$table = new Table('t1');
// t1
$table->only();
// ONLY t1
$table->partition('p1');
// t1 PARTITION (p1)
$table->partition('p1', 'p2');
// t1 PARTITION (p1, p2)
$table->partition(['p1', 'p2']);
// t1 PARTITION (p1, p2)
$table->forPortionOf('date_period', '2025-01-01', '2025-01-31');
// t1 FOR PORTION OF date_period FROM '2025-01-01' TO '2025-01-31'
$table->forPortionOf('date_period', new \DateTime('2025-01-01'), new \DateTime('2025-01-31'));
// t1 FOR PORTION OF date_period FROM '2025-01-01 00:00:00' TO '2025-01-31 00:00:00'
$table->as('t2');
// t1 t2
$table->useIndex();
// t1 USE INDEX ()
$table->useIndex('i1');
// t1 USE INDEX (i1)
$table->useIndex('i1', 'i2');
// t1 USE INDEX (i1, i2)
$table->useIndex(['i1', 'i2']);
// t1 USE INDEX (i1, i2)
$table->useIndexForOrderBy();
// t1 USE INDEX FOR ORDER BY ()
$table->useIndexForOrderBy('i1');
// t1 USE INDEX FOR ORDER BY (i1)
$table->useIndexForOrderBy('i1', 'i2');
// t1 USE INDEX FOR ORDER BY (i1, i2)
$table->useIndexForOrderBy(['i1', 'i2']);
// t1 USE INDEX FOR ORDER BY (i1, i2)
$table->useIndexForGroupBy();
// t1 USE INDEX FOR GROUP BY ()
$table->useIndexForGroupBy('i1');
// t1 USE INDEX FOR GROUP BY (i1)
$table->useIndexForGroupBy('i1', 'i2');
// t1 USE INDEX FOR GROUP BY (i1, i2)
$table->useIndexForGroupBy(['i1', 'i2']);
// t1 USE INDEX FOR GROUP BY (i1, i2)
$table->ignoreIndex('i1');
// t1 IGNORE INDEX (i1)
$table->ignoreIndex('i1', 'i2');
// t1 IGNORE INDEX (i1, i2)
$table->ignoreIndex(['i1', 'i2']);
// t1 IGNORE INDEX (i1, i2)
$table->ignoreIndexForOrderBy('i1');
// t1 IGNORE INDEX FOR ORDER BY (i1)
$table->ignoreIndexForOrderBy('i1', 'i2');
// t1 IGNORE INDEX FOR ORDER BY (i1, i2)
$table->ignoreIndexForOrderBy(['i1', 'i2']);
// t1 IGNORE INDEX FOR ORDER BY (i1, i2)
$table->ignoreIndexForGroupBy('i1');
// t1 IGNORE INDEX FOR GROUP BY (i1)
$table->ignoreIndexForGroupBy('i1', 'i2');
// t1 IGNORE INDEX FOR GROUP BY (i1, i2)
$table->ignoreIndexForGroupBy(['i1', 'i2']);
// t1 IGNORE INDEX FOR GROUP BY (i1, i2)
$table->forceIndex('i1');
// t1 FORCE INDEX (i1)
$table->forceIndex('i1', 'i2');
// t1 FORCE INDEX (i1, i2)
$table->forceIndex(['i1', 'i2']);
// t1 FORCE INDEX (i1, i2)
$table->forceIndexForOrderBy('i1');
// t1 FORCE INDEX FOR ORDER BY (i1)
$table->forceIndexForOrderBy('i1', 'i2');
// t1 FORCE INDEX FOR ORDER BY (i1, i2)
$table->forceIndexForOrderBy(['i1', 'i2']);
// t1 FORCE INDEX FOR ORDER BY (i1, i2)
$table->forceIndexForGroupBy('i1');
// t1 FORCE INDEX FOR GROUP BY (i1)
$table->forceIndexForGroupBy('i1', 'i2');
// t1 FORCE INDEX FOR GROUP BY (i1, i2)
$table->forceIndexForGroupBy(['i1', 'i2']);
// t1 FORCE INDEX FOR GROUP BY (i1, i2)