开发者社区> 问答> 正文

What are Constraints in SQL?

已解决

What are Constraints in SQL?

展开
收起
1780169608831412 2021-10-16 15:00:27 646 0
1 条回答
写回答
取消 提交回答
  • 网络规划设计师、敏捷专家、CISP、ITSS服务经理、ACA全科目、ACP4项、ACE、CBP、CDSP、CZTP等。拥有 PRINCE2 Foundation/Practitioner、CCSK、ITIL、ISO27001、PMP等多项国际认证。 专利5+、期刊10+、知识产权师。核心期刊审稿人。
    采纳回答

    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.
    
    2021-10-16 16:17:48
    赞同 1 展开评论 打赏
问答分类:
SQL
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
SQL Server 2017 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载