delete postgresql code example

Example 1: remove postgresql ubuntu

sudo apt-get --purge remove postgresql
sudo apt-get purge postgresql*
sudo apt-get --purge remove postgresql postgresql-doc postgresql-common

Example 2: postgres delete database

CREATE DATABASE testdb1;
DROP DATABASE testdb1;

Example 3: delete entries in postgresql

DELETE FROM table WHERE condition;

Example 4: postegresql delete

DELETE FROM films
  WHERE producer_id IN (SELECT id FROM producers WHERE name = 'foo');

Example 5: delete entries in postgresql

DELETE FROM table
USING another_table
WHERE table.id = another_table.id;

Example 6: delete from select postgresql

DELETE FROM mytable 
WHERE ctid IN (
    SELECT ctid
    FROM mytable 
    GROUP BY s.serialId, s.valuetimestamp
    ORDER BY s.serialId
    LIMIT 10
)