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 8283273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:40:51+00:00 2026-06-08T10:40:51+00:00

I have a table in an application for which the current schema is: CREATE

  • 0

I have a table in an application for which the current schema is:

CREATE TABLE quotes
(
  id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  quote_request_id INT UNSIGNED NOT NULL,
  quote_amount DECIMAL(12, 2) NOT NULL,
  accepted TINYINT UNSIGNED NOT NULL DEFAULT 0,
  FOREIGN KEY (quote_request_id) REFERENCES quote_requests(id)
) Engine=InnoDB;

I want to enforce a constraint such that only one quote can be accepted for a given quote request – i.e. an UPDATE or INSERT query should fail if it attempts to modify the table such that two or more rows with the same quote_request_id value will have an accepted value of 1.

Is this possible in MySQL? Enforcing constraints such as foreign keys, uniqueness of columns other than the primary key etc. work fine, and I can find information about applying a UNIQUE constraint to multiple columns, but I can’t find anything about more complex constraints which involve multiple columns.

  • 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-06-08T10:40:53+00:00Added an answer on June 8, 2026 at 10:40 am

    Answered by a_horse_with_no_name, but in a comment so it can’t be accepted:

    “I don’t think this is possible without reverting to a trigger in MySQL because MySQL does not support partial indexes.”

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

Sidebar

Related Questions

I have a Java application which queries a database table which the current user
I have an application which has a Projects table and a Users table. In
I have an application in which I'm currently using a two column table in
I have a database application in which a group is modeled like this: TABLE
In an application we are developing, I have access to a database table which
I have table which is filled from external application. I need to fill column
I currently have a Web Application which is using it's own Permissions table which
We have an application which stores its data in SQL Server. Each table has
I have following table structure: CREATE TABLE pilot_groups ( id INT PK, name VARCHAR(50),
I have multi-tenant ASP.NET MVC application which utilizes subdomains to determine the current tenant.

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.