In an employee database, a table called 'employees' has a 'salary' field. The company policy states that no employee should have a salary lower than $30,000. Which type of constraint would be used to ensure this policy is enforced?
A CHECK constraint is used to limit the range of values that can be placed in a column. If you try to insert a salary value of less than $30,000, the database will return an error because of the CHECK constraint. PRIMARY KEY constraints are used to uniquely identify each row in a table. UNIQUE constraints prevent duplicate values in a single column or combination of columns. FOREIGN KEY constraints are used to link two tables together.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What exactly is a CHECK constraint in a database?
Open an interactive chat with Bash
How do other constraints like PRIMARY KEY and UNIQUE differ from CHECK constraints?
Open an interactive chat with Bash
What happens if I try to input a salary below $30,000 with a CHECK constraint in place?