Data-using mysql internal mechanism for computation

Source: Internet
Author: User
Does mysql have such a mechanism? I want to use the result of the previous data and insert a new data. for example, my table has four fields: id, count0, count1, count2; the first piece of data I first query is id1, count01, count12, count23; then I want to insert a new id2 data, count0 and count1, and add 1, respectively, count2 remains unchanged (id2, count02, count13, count23). If you follow the general idea, first query id1 data and obtain count0, count1, count... mysql data

Does mysql have such a mechanism? I want to use the result of the previous data and insert a new data;
For example, I have four fields in this table: id, count0, count1, and count2. The first data item I first queried is id = 1, count0 = 1, count1 = 2, count2 = 3; then I want to insert an id = 2 new data count0 and count1 plus 1, count2 unchanged (id = 2, count0 = 2, count0 = 2, count1 = 3, count2 = 3); in general, I first need to query the data with id = 1, obtain the values of count0, count1, and count2, and then execute the operation, this seems to be a waste of resources,
Now, I want to insert data directly without any queries. what should I do if I use the internal mysql mechanism for direct computation?

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.