Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4568252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:02:58+00:00 2026-05-21T19:02:58+00:00

W3Schools says: The CHECK constraint is used to limit the value range that can

  • 0

W3Schools says:

The CHECK constraint is used to limit the value range that can be
placed in a column.

If we define a CHECK constraint on a single column it allows only certain
values for this column.

If we define a CHECK constraint on a table it can limit the values in
certain columns based on values in
other columns in the row.

From designing a web application perspective, adding this constraint on the DB certainly help me avoiding data corruption and additional level of validation for checking field level data can be avoided in Validation layer of my web application. The only problem I see here is that error message returned from database is not meaningful that can be shown to the end user.

What do you say about this? Or I would ask, in what scenario you’ve used this constraint?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:02:58+00:00Added an answer on May 21, 2026 at 7:02 pm

    The check constraints (as other constraints) are there to guarantee an additional level of coherence, but they must not be used to replace the validation logic in your app, which should, as you mention, display meaningful error messages, and be done (at least) in the presentation layer, before hitting the database.

    Even if they might seem like a duplication of the validation logic, constraints are still useful because

    • the validation logic could be buggy, or forgotten
    • there might be other means to write in the database than the webapp (database scripts, etc.)
    • between the moment the validation logic is executed and the moment the constraints are checked, another transaction might have changed the data in database.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

w3schools says that exceptions can be strings, integers, booleans, or objects, but the example
w3schools says that for height : auto : The browser calculates the height. This
I am modifying the tutorial found here: http://www.w3schools.com/ajax/ajax_aspphp.asp so that the library of autocomplete
I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
All sites that list css properties such like MDN or w3schools list every CSS
Here it says the action attribute is required on form elements: http://www.w3schools.com/tags/att_form_action.asp but I
can't get this tutorial working in localhost: http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax1 my jquery.js file has the following
According to http://www.w3schools.com/WSDL/wsdl_documents.asp binding means communication protocol used by a web-service. I know of
Using the XPath approach defined at http://www.w3schools.com/xpath/xpath_examples.asp I can easily access elements in an
According to W3Schools the property is used to align text within elements. When using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.