2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-03 15:40:17 +00:00
cheat.sheets/sheets/_psql/update

28 lines
624 B
Plaintext
Raw Normal View History

2018-01-07 11:42:08 +00:00
# Insert a new row into a table
INSERT INTO table(column1,column2,...)
VALUES(value_1,value_2,...);
# Insert multiple rows into a table
INSERT INTO table_name(column1,column2,...)
VALUES(value_1,value_2,...),
(value_1,value_2,...),
(value_1,value_2,...)...
# Update data for all rows
UPDATE table_name
SET column_1 = value_1,
...;
# Update data for a set of rows specified by a condition in WHERE clause
UPDATE table
SET column_1 = value_1,
...
WHERE condition;
# Delete all rows of a table
DELETE FROM table_name;
# Delete specific rows based on a condition
DELETE FROM table_name
WHERE condition;