PostgreSQL DML Operations

From NovaOrdis Knowledge Base
Revision as of 19:32, 24 May 2024 by Ovidiu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

INSERT

Standard SQL INSERT
INSERT INTO person (id, name) VALUES (10, 'Bob')

Double quotes can be used around column names.

Use single quotes for the string values. Double quotes will let the SQL interpreter think you use a column name.

UPDATE

Standard SQL UPDATE
UPDATE person SET id=50 WHERE name='Bob'

Double quotes can be used around column names.

DELETE

Standard SQL DELETE
DELETE FROM person WHERE id=10

Double quotes can be used around column names.

SELECT

Standard SQL SELECT
SELECT "id", "name" FROM person