Skip to main content
Version: 1.2.6

Delete Query

delete records from the table This page uses the following methods:

  • await presql.destroy(<filter>)
  • await presql.destroyAll(<filter>)
  • await presql.remove(<filter>) -Comming Soon
  • await presql.table('').destroy(<filter>) -Comming Soon
  • await presql.table('').destroyAll(<filter>) -Comming Soon

Delete One Record

This Function deletes one record from the table , where field is specified to delete a specific record , otherwise throws an exception.
Create a file at index.js:

index.js
import presql from './connection';

async function DeleteSingle() {
const data = await presql.destroy({
table: 'users', // table name where record is to be inserted e.g.
where: {
id: 1
}, // where field is must,
})
console.log(data); // if showResults is true, it will print results
}

Delete All Records

This Function deletes all record from the table at a time, where field is optional here,it will delete all records from the table. To delete a specific record, please pass the where field

Create a file at index.js:

index.js
import presql from './connection';

async function DeleteAll() {
const data = await presql.destroyAll({
table: 'users', // table name where record is to be inserted e.g.

})
console.log(data); // if showResults is true, it will print results
}