PostgreSQL Delete Data

Source: Internet
Author: User
Tags postgresql

So far we've explained how to add data to a table and how to change it. The rest is to discuss how to delete data that is no longer needed. As with previous additions, deleting data must be deleted from the entire row in the table. In the previous section, we mentioned that SQL does not provide a way to specify a row directly. Therefore, deleting a row can only be done by declaring that the deleted row must match the condition. If you have a primary key on the table, you can declare the exact row. Of course, you can also delete a set of rows that match the criteria, or delete all the rows in the table at once.

We use the Delete command to delete a row. Its syntax is very similar to the UPDATE command. Use:

DELETE from Sites WHERE name = ' Www.infocool.net ';

If you just write:

DELETE from Sites;

Then all the rows in the table will be deleted! Programmers must be careful.

PostgreSQL Delete Data

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.