SQL - Structured Query Language |
NOT NULL ConstraintNULL is a unique mark in the SQL that indicate data value does not exist in the Database. NULL concept was introduced by Dr.E.F. Codd to represent missing data in the Relational Database Model. By default, all columns can store with NULL data value in the Relational Database. NOT NULL Constraint is used define in the mandatory column that absolutely needs data value. The following SQL Statements are used to create DEPT and EMP Tables with set of constraints. -- Sample Statements --
CREATE TABLE DEPT ( Dept_Code numeric(5) Primary Key, Dept_Name varchar(50) Not Null, ) GO
CREATE TABLE EMP ( Emp_Code numeric(5)Primary Key, Emp_Name varchar(50) Not Null, DOJ datetime Default GetDate(), Salary numeric(7,2) Check (salary > 1000 and Salary < 5000), Phone varchar(50), Dept_Code numeric(5) References DEPT(Dept_Code) On Delete Cascade ) GO More Reference URL: https://data-e-education.com/RDBMS/Domain_Integrity_Constraints.php |
* * * * *