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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:55:58+00:00 2026-06-11T10:55:58+00:00

Can a Bool field become a unique index and used for a foreign key

  • 0

Can a Bool field become a unique index and used for a foreign key relationship in conjunction with another table’s index?

I don’t think it can become primary key but what about unique index? Every time I try to make it into a unique index it converts it into a tinyint.

EDIT

So I have a SQL relationship problem. Lets say I have a database where I want to keep records of information about individuals. Now I have setup a table to take on that information. Okay so far so good.

Often times duplicate information can be discovered in the table and it would be removed. A record is considered a duplicate if a particular field has the same value as another field in another row. Example: Duplicate emails.

Now I want to create another table in the database to keep track of every duplicate that is ever discovered and deleted. My first thought into this was to create a Foreign Key relationship. So I created and then connected a dupes table to my persons table. The relationship was a simple Foreign to Primary key relationship with an on delete constraint.

Now while that may have worked at first the problem arose that the dupes table was receiving records that were deleted even if they were not deleted because they were dupes. This was a problem because even if I decided to delete a person from the persons table just because I did not like them, they would stored in the dupes table anyway.

Then I thought, why not create a disposition field in the persons table and connect that as a unique or primary key to my dupes table’s index foreign key. Well the problem is a unique key must have a unique value so multiple dispositions of dupe or I don’t like you would not work. The other option was to make the disposition field a primary key. That has the same problem though.

What would be the right relationship for this problem?

  • 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-11T10:55:59+00:00Added an answer on June 11, 2026 at 10:55 am

    Essentially a bool-value in sql (or bit in mssql) is an very short integer. So basically there’s no reason that it would not be allowed as foreign key.
    But from a design perspective it does not make any sense.

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

Sidebar

Related Questions

I can't update when I change some field in my table. Database ==> mysql
I'm getting this error: Templates can be used only with field access, property access,
How can I detect the very first time launch of - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
Can i pass strings as arguments during method.Invoke(objectname,object[]params) for a method of signature Getdetails(int,string,bool)
I can get this to work: [<DllImport(user32.dll)>] extern bool GetClientRect(nativeint, RECT*) let getClientRect hwnd
bool operator()(Iterator it1, Iterator it2) const { return (*it1 < *it2); } Can someone
In C++, can I depend upon a new bool being initialized to false in
Mysql has two types that can hold boolean data, bit and bool. Bit(1) seems
I have two objects that can be represented as an int, float, bool, or
I like c#, but why can I do : public static bool Initialized {

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.