Delete specific rows

postgres, console, db – Aug 25 2018

The shortcut command to delete specific rows from the console

• • •

If you need to delete specific rows you can do so by the follow

DELETE FROM users where username = 'a1';

To remove all rows in the users table, you omit the WHERE clause in the DELETE statement:

DELETE FROM users;

Delete all rows in the users table and return the deleted rows, you use the RETURNING clause in the DELETE statement as follows:

DELETE FROM link RETURNING *;
Follow on Twitter
Follow on Github