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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:45:27+00:00 2026-06-01T12:45:27+00:00

What is the best constraint to use on a forum table where users leave

  • 0

What is the best constraint to use on a forum table where users leave comments?

Assuming some users will be deleted at a later stage. if i delete a user who has commented, what happens to the users entry in the table?

Hope someone can explain.

  • 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-01T12:45:29+00:00Added an answer on June 1, 2026 at 12:45 pm

    There are two parts to this question:

    1. how best to implement this? You can “soft-delete” user rows. This has the advantages of:

      • not losing user information
      • allowing users to be un-deleted
      • maintaining referential integrity without losing data linked to users

      Soft-deleting can be implemented by adding another column to the users table, with a dateDeleted column — if it’s Null, then the user isn’t deleted. I believe SO uses such a mechanism for deleting posts.

    2. what does restrict cascade no action do? The MySQL docs say

    • RESTRICT: Rejects the delete or update operation for the parent table.
      Specifying RESTRICT (or NO ACTION) is the same as omitting the ON
      DELETE or ON UPDATE clause.

    • NO ACTION: A keyword from standard SQL. In MySQL, equivalent to
      RESTRICT. InnoDB rejects the delete or update operation for the parent
      table if there is a related foreign key value in the referenced table.
      Some database systems have deferred checks, and NO ACTION is a
      deferred check. In MySQL, foreign key constraints are checked
      immediately, so NO ACTION is the same as RESTRICT.

    In other words, if you use this, you won’t be able delete rows if doing so would break referential integrity.

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

Sidebar

Related Questions

With the constraint that you can't use jquery, what's the best way to get
What's the best way of dealing with variables in constant use in an iPhone
What is the best way to express range constraint in JPA? I would like
Best practice is to use unique ivs, but what is unique? Is it unique
Best to use an example to describe the problem. Lets say I have a
I would like to replace some of the sequences I use for id's in
I have a table, let's call it Users . This table has primary key
Mapping database with Hibernate. We should use Double with @NotNull constraint Or use the
I'd like to use SQLite FTS3 (FTS4, actually) to index a table with integer
Preamble: I'm creating some tables in SQL Server that will be accessed via Linq-to-entities

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.