An analytics team is collecting rating values that must be within a 1–10 range. Their database currently allows out-of-range inputs, which skews the overall results. What is the BEST option to address this issue?
Implement a CHECK constraint to enforce ratings between 1 and 10 at the database level
Manually review and block invalid ratings after they are stored
Automatically replace out-of-range ratings with the nearest valid value before saving
Switch the rating column to allow text data to handle a broader set of inputs
Using a CHECK constraint on the rating field ensures that only values within the specified range are accepted by the database. This proactively prevents invalid data at the point of entry, maintaining data integrity. Other options, such as filtering invalid data after storage or increasing field flexibility, are less effective at addressing the root cause.
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 is a CHECK constraint in a database?
Open an interactive chat with Bash
How does implementing a CHECK constraint maintain data integrity?
Open an interactive chat with Bash
What are some alternative methods to handle invalid data inputs?