Which constraints we can use while creating a database in SQL?

Total Post:7

Points:49

 557  View(s)
Ratings:
Rate this:

Which constraints we can use while creating a database in SQL?

  1. Re: Which constraints we can use while creating a database in SQL?

    The constraints are used to set the rules for all records in the table. Although any constraints get violated then it can abort the action that caused it.

    The constraints are defined while creating the database itself with CREATE TABLE statement or even after the table is created once with the ALTER TABLE statement.

    These are 5 major constraints are used in SQL, such as

    NOT NULL: This indicates that the column must have some value and cannot be left null

    UNIQUE: These constraints are used to ensure that each row and column has unique value and no value is being repeated in any other row or column

    PRIMARY KEY: These constraints are used in association with NOT NULL and UNIQUE constraints such as on one or the combination of more than one columns to identify the particular record with a unique identity.

    FOREIGN KEY: This is used to ensure the referential integrity of data in the table and also matches the value in one table with another using Primary Key

    CHECK: This is used to ensure whether the value in columns fulfills the specified condition

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.