How can I insert only data?

Source: Internet
Author: User
How can we insert data only in php and know that duplicate values exist when inserting data into the table consecutively? but how can we insert non-duplicate values into the table only, duplicate values cannot be inserted automatically. unique & nbsp; key, primary & nbsp; Key is not used. Insert & nbsp; into (a, B, c) & nbsp; table_name & nbsp; values & nbsp; (how can a1 and a2 only insert data?
In php, repeated values are already known when data is inserted into the table consecutively. but how can we insert non-repeated values into the table? duplicate values cannot be inserted automatically, the unique key and primary Key are not used.


Insert into ('A', 'B', 'C') table_name values ('A1 ', 'A2', 'A3 '), ('A4', 'a5 ', 'a6 '), ('a8', 'a7 ', 'a9 '). duplicate values ('A4 ', 'a5', 'a6 ') in the table. how can I insert a duplicate value ('A4', 'a5 ', 'a6 '), but you can insert ('A1', 'A2 ', 'A3'), ('a8', 'a7 ', 'a9 ').

PHP

Share:


------ Solution --------------------
Insert ignore into table_name VALUES ('A1 ', 'A2', 'A3 '), ('A4', 'a5 ', 'a6'), ('a8 ', 'a7 ', 'a9 ')

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.