Vital.sandbox
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 :where to target specific rows for deletion
  • Multiple deletions — chain multiple :delete calls to append additional row deletions
  • Multiple conditions — chain multiple :where calls to apply additional filters to the deletion
  • Without conditions — omitting :where will delete all rows in the table

Parameters

TypeNameDescription

Returns

TypeNameDescription
db_query / boolqueryQuery 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()

On this page