Add NOT NULL and DEFAULT to a column
SQL
Easy
7 views
Problem Description
You have a table Employees(emp_id, name, dept_id, salary, hire_date). Make dept_id mandatory and set default salary as 30000 for new rows.
Output Format
DDL statement(s)
Sample Test Case
Input:
Employees(emp_id, name, dept_id, salary, hire_date)
Constraints
Use generic SQL
Official Solution
ALTER TABLE Employees ALTER COLUMN dept_id SET NOT NULL; ALTER TABLE Employees ALTER COLUMN salary SET DEFAULT 30000;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!