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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:07:49+00:00 2026-05-11T09:07:49+00:00

I have a MySQL database table with two columns that interest me. Individually they

  • 0

I have a MySQL database table with two columns that interest me. Individually they can each have duplicates, but they should never have a duplicate of BOTH of them having the same value.

stone_id can have duplicates as long as for each upsharge title is different, and in reverse. But say for example stone_id = 412 and upcharge_title = ‘sapphire’ that combination should only occur once.

This is ok:

stone_id = 412 upcharge_title = 'sapphire' stone_id = 412 upcharge_title = 'ruby' 

This is NOT ok:

stone_id = 412 upcharge_title = 'sapphire' stone_id = 412 upcharge_title = 'sapphire' 

Is there a query that will find duplicates in both fields? And if possible is there a way to set my data-base to not allow that?

I am using MySQL version 4.1.22

  • 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. 2026-05-11T09:07:49+00:00Added an answer on May 11, 2026 at 9:07 am

    You should set up a composite key between the two fields. This will require a unique stone_id and upcharge_title for each row.

    As far as finding the existing duplicates try this:

    select   stone_id,          upcharge_title,          count(*) from     your_table group by stone_id,          upcharge_title having   count(*) > 1 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Should a database table that contains two columns that are foreign keys have a
I have table in MySQL database with two integer columns for example: userid |
Okay, so let's say I have a mysql database table with two columns, one
I have the following two tables in my mysql database. Table Name: groups id
In a MySQL database I have two tables linked in a join. One table
What I have is two tables inside of a mysql database. One table contains
I have a MySQL database table called Participant that looks something like this: (idParticipant)
I have a MySQL database with two tables (simplified for this question): movies table
I have the two columns in my table within Mysql. The Columns are Amount
I have this table in a mysql database: mysql> show columns from wifi_network_config_auth_algorithm; +------------------------+-------------+------+-----+---------+-------+

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.