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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:06:42+00:00 2026-05-23T19:06:42+00:00

I’m designing a database that will be the backend for a marketplace website. There

  • 0

I’m designing a database that will be the backend for a marketplace website. There will be buyers and sellers creating accounts. I am planning on having a single sign in form for all types of account and a central accounts table that will hold account details common to all types of account, where user credentials will be stored and can be checked against when any user signs in.

The user credentials will consist of Email and Password. The Email column of the table will be a unique column so an email address can only corrospond to a single account.

But the problem appears when a user wants to delete their account. A user will be able to terminate their account but much of the data related to their account shall be retained in the database. It shall be necessary to retain the data as it will be relevant to other users and the site in general. For example messages, orders, disputes etc. As data has to be kept for buyers to see details about sellers in their past order, really all account data has to be kept and just given a status of terminated.

So what happens if once a user has terminated their account but they try to create a new account with the same email address? They wouldn’t be allowed to because there is already an account with that email address and a terminated status.

My first idea was to replace the email address with a null when an account is terminated. So the email could be used again for a new account, but then I realised a unique column can only have one NULL value.

My next idea was to transfer termiated accounts to another table and remove the email column. However this doesn’t make sense as many other tables in the database will have foreign keys that reference the original table.

Another Idea is to have three core account tables.

AccountInventory: AccountID_PK, Status

ActiveAccounts: AccountID_PK, Email, Password, PasswordSalt, AccType, AccStatus

TerminatedAccounts: AccountID_PK, AccType

This way I could reference the AccountInventory table with foreign keys in my other tables. Use the ActiveAccounts table to check credentials as users sign in. And move deleted accounts to the TerminatedAccounts table whilst still maintaining referential integrity of other data to that account as foreign keys reference AccountInventory.

Is this the best way to achive this functionality of enabling users to reuse an email address whilst maintaing the integrity of the data? It seems a little awkward to me having an AccountInventory table that essentially holds nothing other than Account IDs that all other tables that need to JOIN with ActiveAccounts or Terminated Accounts will have to JOIN though.

So is this the best solution or is there a smarter way of doing this?

Kind Regards,
Duncan

  • 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-23T19:06:42+00:00Added an answer on May 23, 2026 at 7:06 pm

    What about a User table with an unique key based on email AND status?

    You still can have referential integrity but poses a problem when that user wants to cancel second account. In this case, you could to merge those two accounts, as refers to same user.

    If that merge isn’t possible, you could also to create a date range where that account is valid and making it part of your unique index, and enforce there’s only an email address valid at time using triggers or something similar.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I have a reasonable size flat file database of text documents mostly saved in

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.