PostgreSQL DML Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 13: Line 13:
{{Internal|SQL_UPDATE#Overview|Standard SQL <tt>UPDATE</tt>}}
{{Internal|SQL_UPDATE#Overview|Standard SQL <tt>UPDATE</tt>}}
<syntaxhighlight lang='sql'>
<syntaxhighlight lang='sql'>
UPDATE person SET "id"=50 WHERE "name"='Bob'
UPDATE person SET id=50 WHERE name='Bob'
</syntaxhighlight>
</syntaxhighlight>



Revision as of 19:31, 24 May 2024

Internal

INSERT

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

Note: 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'

DELETE

Standard SQL DELETE
DELETE FROM person WHERE "id"=10

SELECT

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