Thursday, October 28, 2021

What are the SQL constraints?

What are the SQL constraints?

Ans:

SQL constraints are used to specify rules for the data in a table. Constraints are used to limit the type of data that can go into a table


 1.     NOT NULL Constraint − Ensures that a column cannot have NULL value.

2.     DEFAULT Constraint − Provides a default value for a column when none is specified.

3.     UNIQUE Constraint − Ensures that all values in a column are different.

4.     PRIMARY Key − Uniquely identifies each row/record in a database table.

5.     FOREIGN Key − Uniquely identifies a row/record in any of the given database table.

6.     CHECK Constraint − The CHECK constraint ensures that all the values in a column satisfies certain conditions.

7.     INDEX − Used to create and retrieve data from the database very quickly.(a unique index has the same effect as a unique constraint on the same columns. So, you can think of a unique index as implementing a unique constraint.

No comments:

Post a Comment

"๐Ÿš€ Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!"

"๐Ÿš€ Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!" Big news for data engineers! Delta Lake 2.0+ in...