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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:00:38+00:00 2026-06-02T03:00:38+00:00

Is it possible to make a row in a database table unique? If so

  • 0

Is it possible to make a row in a database table unique? If so how? I know you can make a field unique so for example ‘John’ could not appear twice in a name field. But what if I have something like:

name: John
id: 1
foreign_key: 1

name: John
id: 2
foreign_key: 1

In this instance it would be fine as they are the same but different.

Where as this would be prevented:

name: John
id: 1
foreign_key: 1

name: John
id: 1
foreign_key: 1

It’s difficult to demonstrate as the obvious answer would be to make the foreign_key unique but in my case it’s a many to many relationship so the ID or foreign key could appear many many times but shouldn’t ever have the same data in all the columns.

I.e this should work:

id: 1
fKey: 2
afKey: 3

id: 1
fKey: 3
afKey: 3

BUT not when fKey and afKey match in two rows like:

id: 1
fKey: 2
afKey: 3

id: 1
fKey: 2
afKey: 3
  • 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-02T03:00:39+00:00Added an answer on June 2, 2026 at 3:00 am

    To make the row unique you could make all 3 columns a composite primary key.

    http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html

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

Sidebar

Related Questions

how can I automatically add the value of a database row (PHP), to the
Can we add multiple rows in the database table from one JSF page in
I have a table in my database with two columns as int for example
I'm creating a SQLite database where it is possible to make entries for a
Is it possible make some handler that will do something when user shutdown computer
Is it possible make an activity, that will lock the android device? That device
Possible Duplicate: Make iPhone app paid version replace free version on install from app
is possible to make own help message or attach own event on help option
Is it possible to make a Flash embedded in a browser access a DLL,
it is possible to make own plugin to media center in windows (in .NET)?

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.