...

/

Answer: The NOT NULL Constraint

Answer: The NOT NULL Constraint

Find a detailed explanation of how to set up the NOT NULL constraint.

Solution

The solution is given below:

Press + to interact
/* Modifying the column EmpName to be NOT NULL */
ALTER TABLE Employees
MODIFY COLUMN EmpName VARCHAR (100) NOT NULL;
/* Modifying the column Salary to be NOT NULL */
ALTER TABLE Employees
MODIFY COLUMN Salary DECIMAL (10,2) NOT NULL;
/* Describe the structure of the table */
DESC Employees;

Explanation

The explanation of the solution code is given below:

  • Lines 2–3: The ALTER TABLE make changes to an already existing Employees table. The MODIFY COLUMN modifies the column EmpName column to be NOT NULL.

  • Lines 6–7: The ALTER TABLE make changes to an already existing Employees table. The MODIFY ...