Add a CHECK constraint using ALTER

Add a CHECK constraint using ALTER

Medium SQL DDL 22 views
Explanation Complexity

Problem Statement

In Products, price must be >= 1. Add a CHECK constraint.

Input Format

SQL DDL

Output Format

DDL statement(s)

Example

Products(price)
Constraint added

Constraints

Assume table exists

Input / Output Format

Input Format
SQL DDL
Output Format
DDL statement(s)
Constraints
Assume table exists

Examples

Input:
Products(price)
Output:
Constraint added

Example Solution (Public)

SQL
ALTER TABLE Products ADD CONSTRAINT chk_price_min CHECK (price >= 1);

Official Solution Code

ALTER TABLE Products ADD CONSTRAINT chk_price_min CHECK (price >= 1);
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.