PostgreSQL Flow account (fifth day): adding and deleting changes

Source: Internet
Author: User
Tags postgresql

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:

    1. The name of the table and column to update
    2. The new value of the column
    3. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.