PostgreSQL DELETE
DELETE Command
This document discusses how to delete data of a table using PostgreSQL DELETE command.
Usage
Following is the usage of PostgreSQL DELETE command to delete data of a PostgreSQL table.
DELETE FROM table_name ;
Where table_name is the associated table. Executing this command will delete all the rows of the associated table.
DELETE FROM table_name WHERE condition;
If you don't want to delete all of the rows of a table, but some specific rows which match the "condition", execute the above.
DELETE all rows of table
Structure of the table
Following is the structure of the table whose data will be deleted.

Data Before deletion

Command to delete data
Code:
DELETE FROM book;
This command will delete all of the rows of the book table.
DELETE specific rows of a table
Code:
DELETE FROM book WHERE price < 25.00
This command will delete all the rows, which stores information about a book, whose price is less than 25.00.
Previous: Update Data
Next: CONSTRAINT
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook