Posted On: Dec 17, 2020
Constraints are the rules or limits that we can apply to the type of data in a table
The available constraints in SQL are:
NOT NULL: This constraint tells us that we cannot store a null value in a column.
UNIQUE: This constraint when specified with a column, tells that all the values in the column must be unique.
PRIMARY KEY: A primary key is a field that can uniquely identify each row in a table. Typically, used to specify a field in a table as the primary key.
FOREIGN KEY: A Foreign key is a field that can uniquely identify each row in another table.
CHECK: This constraint helps to validate the values of a column to meet a particular condition.
DEFAULT: This constraint specifies a default value for the column when no value is specified by the user.
For instance,
REATE TABLE Student ( ID int(6) NOT NULL, NAME varchar(10) NOT NULL, ADDRESS varchar(20) );
Never Miss an Articles from us.
In programming, Array is a collection of similar types of values in a single unit. Array stores data in a contiguous memory location....
The OSI model is a networking model for understanding and designing a network architecture that would be flexible, robust, and interoperable. Communication between different systems without requiring ...
The four pillars of OOPs are as follows:Inheritance Abstraction Encapsulation Polymorphism ...