PostgreSQL DELETE statement
Introduction
In this section you will learn how to implement the PostgreSQL DELETE statement and PostgreSQL DELETE USING(JOIN) statement through KSearch library.
The Postgresql DELETE statement allows you to delete one or more rows from a table.
Syntax:
DELETEFROM table_nameUSING another_table_nameWHERE conditionsTo generate this type of statement through library you will need:
- Specify the name of the table from which you want to delete rows. This is done through the table() method.
- Specify one or more tables in the
USINGclause through the using() method. - Use the columns of the tables that appear in the USING clause in the WHERE clause for joining data.
- Add the necessary conditions in the
WHEREclause. - Build and execute the statement through the delete() method.
This type of statement has the insurance against null conditions implemented. What is this?