Add: Insert
INSERT into Products (product_no, name, price) VALUES
(1, ' Cheese ', 9.99),
(2, ' Bread ', 1.99),
(3, ' Milk ', 2.99);
You can insert more than one row of data at a time.
INSERT into Products (product_no, name, Price) VALUES (1, ' Cheese ', DEFAULT);
INSERT into Products DEFAULT VALUES;
INSERT into Products (product_no, name) VALUES (1, ' Cheese ');
INSERT into Products VALUES (1, ' Cheese ');
Inserts a default value, assigns a value from left to right, no value or unspecified value, or explicitly assigns all columns a default value.
?
?
Delete: Delete
DEDELETE FROM products;
LETE FROM products WHERE price = 10;
Delete the record that satisfies the Where condition or
Delete all records (if a Where condition is not provided)
?
?
Change: Update
To update existing rows, use the? Update?command. This requires three pieces of information:
- The name of the table and column to update
- The new value of the column
- which row (s) to update
?
UPDATE mytable SET A = 5, B = 3, c = 1 WHERE a > 0;
UPDATE Products SET Price = Price * 1.10;
You can update all records, or you can update a record, depending on where condition.
You can update multiple fields.
If no record satisfies the Where condition, no error is recorded.
?
Check: Select
PostgreSQL Flow account (fifth day): adding and deleting changes