What are Constraints in SQL?-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

What are Constraints in SQL?

1780169608831412 2021-10-16 15:00:27 42

What are Constraints in SQL?

SQL
云服务器登录 云服务器设置
分享到
取消 提交回答
全部回答(1)
  • 无敌小将
    2021-10-16 16:17:48
    已采纳

    Constraints are used to specify the rules concerning data in the table. It can be applied for single or multiple fields in an SQL table during the creation of the table or after creating using the ALTER TABLE command. The constraints are:

    NOT NULL - Restricts NULL value from being inserted into a column.
    CHECK - Verifies that all values in a field satisfy a condition.
    DEFAULT - Automatically assigns a default value if no value has been specified for the field.
    UNIQUE - Ensures unique values to be inserted into the field.
    INDEX - Indexes a field providing faster retrieval of records.
    PRIMARY KEY - Uniquely identifies each record in a table.
    FOREIGN KEY - Ensures referential integrity for a record in another table.
    
    1 0
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

相似问题
最新问题