Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 517 Bytes

query-delete.md

File metadata and controls

30 lines (23 loc) · 517 Bytes
layout title
default
Delete Queries

It is recommended to always include a WHERE statement:

$query = $factory
    ->delete('users')
    ->where(field('login_at')->isNull())
    ->compile();

$query->sql(); // DELETE FROM "users" WHERE "login_at" IS NULL
$query->params(); // []

It is also possible to provide a LIMIT:

$query = $factory
    ->delete('users')
    ->limit(5)
    ->compile();

$query->sql(); // DELETE FROM "users" LIMIT 5
$query->params(); // []

Back