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

  • Home
  • SEARCH
  • 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 7447015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:29:19+00:00 2026-05-29T12:29:19+00:00

I am using MySQL and here is a simple query set: create table dcheck

  • 0

I am using MySQL and here is a simple query set:

create table dcheck (
    fdate date,
    sdate date,
    check (fdate <= sdate)
);

insert into dcheck values ('2006-12-12','2003-12-12');
insert into dcheck values ('2003-12-12', '2006-12-12');

Here I expect the first insert statement to fail. But surprisingly, both the queries passes and two rows are there in the table.

Can anyone please explain why?

Thanks

  • 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-29T12:29:21+00:00Added an answer on May 29, 2026 at 12:29 pm

    MySQL doesn’t implement CHECK constraints. From the latest (5.6) fine manual:

    The CHECK clause is parsed but ignored by all storage engines.

    So the syntax is parsed for compatibility other other SQLs but the checking is not implemented.

    You could fake your CHECK constraint with BEFORE INSERT and BEFORE UPDATE triggers that threw an exception if the desired condition was not met.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple php/mysql INSERT such as mysql_query(INSERT INTO dispatch VALUES('1234','$name','$address')); intermittently fails. I've set it
I am trying to do a simple insert into MySQL. I am using mysqli
I have an incredibly simple query (table type InnoDb) and EXPLAIN says that MySQL
This is a winform and I'm using mysql as a database, here is my
Using MySQL syntax and having a table with a row like: mydate DATETIME NULL,
Using MySQL syntax, how would I write a query to return the following (I
I have a MySQL query that I'd like help optimizing. Its rather simple in
(Using MySQL 4.1.22) I can't get this query of mine to use an index
I want to make a simple news system using PHP and MySQL, right now
I have a large mysql table (about 5M rows) on which i frequently insert

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.