Some details about the SQL statement

Source: Internet
Author: User

First, inserting insert

1. Effect of primary key on data insertion
The primary key must be unique in the same table if the primary key specified when the data is inserted is already in the table
Duplication of data will result in an exception that violates the PRIMARY KEY constraint.

2. Effect of foreign key on data insertion
A foreign key is a constraint that points to an existing data in another table, so the foreign key value must be present in the target table. If the plug
Non-existent data in the target table will result in a violation of the FOREIGN KEY constraint exception.

Second, update updates:

1. The effect of non-null constraints on data update
As the expression "non-null constraint" means, if a non-null constraint is added to a field, we cannot
The values in the field are updated to NULL.

2. Effect of primary key on data update
The primary key must be unique in the same table if the primary key specified in the data update is already in the table
Duplication of data will result in an exception that violates the PRIMARY KEY constraint.

3. Influence of foreign key on data update
A foreign key is a constraint that points to an existing data in another table, so the foreign key value must be present in the target table. If more
The new data does not exist in the target table, which results in a violation of the FOREIGN KEY constraint exception.

Third, search

1, COUNT (*) and count (fields) are not the same

If a field is null,count the column does not count empty fields in it


Some details about the SQL statement

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.