Friday, February 22, 2019

SQL Constraints

In this blog, we will discuss about the SQL constraints like Primary Key, Not NULL etc. and what type of constraints are available in SQL and their purposes.

SQL constrains is used to enforce the data rule while inserting or updating record in table. If rule is not satisfied, it will not allowed to complete the action. It ensures the data accuracy and reliability in the table.

Following SQL constraints are used in SQL: 
  • Primary Key -  it uniquely identify each row in table but it cannot accept NULL value
  • Unique Key -  it ensure the column’s value are not duplicate
  • Foreign Key – it enforce the integrity constraints and make sure the referenced key is uniquely identify each row in the referenced table
  • Check  - it ensure the inserted or updated value matched with given values
  • Not NULL – it ensures the column cannot accept NULL value
  • Default – set default value for a column, if value is not specified.
Thanks for visiting!!

No comments:

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...