(attached) MySQL: Learn SQL syntax on W3Schools documents (constraint summary)

Source: Internet
Author: User

Constraints: Set criteria to limit the data that is filled into the table, or to set properties on the data for a column in a table (for example: not full, the settings fill in the data is not empty)

Conditional filtering: Can be used to fill in a table or data from a table, the role is to meet certain conditions of their own (such as: Select when using where to get the data you want)

1.

Constraints are used to specify the characteristics of tabular data

2.

Constraints can be used to restrict the data type and characteristics of a table, which guarantees the reliability of tabular data, and data operations are aborted when data operations violate constraints

3. There are the following common constraints:

3.1

Not NULL (non-NULL)------guarantees that a column of data cannot have a null value

3.2

Unique------Ensure that a column of data is not duplicated (unique)

3.3

PRIMARY key (primary key)------union the "non-null" and "unique" attributes (that is, a column of data can not have null values can not be duplicated), the only one in the table to flag a row (that is, the meaning of this line)

3.4

FOREIGN key (foreign key)------used to mark a row of this table in another table or this table

3.5

CHECK------Ensure that a column of data meets a particular condition

3.6

The default------sets an initial value that is set to this value when the data is not assigned

3.7

INDEX------used to quickly create and retrieve data from a database

4. This is a constraint summary, I'll try these constraints later, (not full,unique,primary key has been tried in the blog that added the primary key)

(attached) MySQL: Learn SQL syntax on W3Schools documents (constraint summary)

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.