Database
db_query:delete
Server
Appends a row deletion to the query
Syntax
local query = db_query:delete()This function only prepares the query and does not execute it. Chain db_query:execute at the end to commit the query to the database.
- Chaining — compatible with
:whereto target specific rows for deletion - Multiple deletions — chain multiple
:deletecalls to append additional row deletions - Multiple conditions — chain multiple
:wherecalls to apply additional filters to the deletion - Without conditions — omitting
:wherewill delete all rows in the table
Parameters
| Type | Name | Description |
|---|
Returns
| Type | Name | Description |
|---|---|---|
db_query / bool | query | Query builder instance on successful execution, or false on failure |
Examples
local db = database.create("127.0.0.1", "root", "", "vital_sandbox")
--Delete a specific player record
db:table("players")
:delete()
:where("name", "=", "aviril")
:execute()