-
Notifications
You must be signed in to change notification settings - Fork 0
delete
Defines the query type as a DELETE statement. The column and value for an equality where statement can be defined within this method or you can use the where method.
📌 Execution Required: This method only constructs the SQL statement. You must terminate the method chain with
->execute()to actually run the query against the database or->preview()to view the sql code.
delete(): static
delete(?string $column = null, mixed $value = null): static
column (?string) : The column (or field) within the database. ^(optional)^
value (mixed) : The value of the column. ^(optional)^
(static) : Returns the current instance to allow for method chaining.
NOTE: This method does not execute the query immediately. You must chain the
execute()method at the end of your chain to run the query against the database.Upon successful execution, the
execute()method returns theintrepresenting the number of affected rows.
Before calling execute(), you can chain the following modifiers to customize your results:
-
between(...)[?]: Filters data within an inclusive range. -
in(...)[?]: Filters data that matches any value in a specified list.-
notIn(...)[?]: Filters data that excludes everything in a specified list
-
-
like(...)[?]: Filters data by matching a specific text pattern using wildcards. -
where(...)[?]: Filters query results by applying specific conditions to rows.
$db->delete('id', 12)->execute();
// Result: DELETE FROM `table` WHERE `id` = 12
$db->delete()->where('user', 'name')->execute();
// Result: DELETE FROM `table` WHERE `user` = 'name'
- Throws an exception if the where clause is omitted.
- Logs a warning if only one argument is provided.
insert | replace | select | show | update
Home | CoreyDB | Operations