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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:45:22+00:00 2026-05-24T02:45:22+00:00

ALTER TABLE admins ADD CONSTRAINT uc_EmailandDeleted_at UNIQUE (email,deleted_at); I have changed my table to

  • 0
ALTER TABLE admins ADD CONSTRAINT uc_EmailandDeleted_at UNIQUE (email,deleted_at);

I have changed my table to work as this:

ID  EMAIL                  DELETED_AT  
1.  user@example.com          NULL             <- accept  
2.  user@example.com          NULL             <- reject because of uniqueness.

But Its not working as I wish. If i gave two identical dates to

deleted_at

It is generating error as I expect. But not for NULL values. Any idea?

NB: I can’t change the behaviors of deleted_at column because I am using acts_as_paranoid. So I have to keep deleted_at field to be NULL or any date.

  • 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-24T02:45:23+00:00Added an answer on May 24, 2026 at 2:45 am

    From the documentation:

    A UNIQUE index creates a constraint such that all values in the index
    must be distinct. An error occurs if you try to add a new row with a
    key value that matches an existing row. This constraint does not apply
    to NULL values except for the BDB storage engine. For other engines, a
    UNIQUE index permits multiple NULL values for columns that can contain
    NULL.

    The above excerpt from MySQL 5.0. MySQL dropped the BDB storage engine in 5.1.12.
    So now from the latest documentation:

    For all engines, a UNIQUE index permits multiple NULL values for columns that can contain NULL. If you specify a prefix value for a column in a UNIQUE index, the column values must be unique within the prefix.

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

Sidebar

Related Questions

I have this sql: ALTER TABLE dbo.ChannelPlayerSkins DROP CONSTRAINT FK_ChannelPlayerSkins_Channels but apparently, on some
I have used this query to alter the table field: ALTER TABLE `recordstudent` CHANGE
mysql> ALTER TABLE category ADD CONSTRAINT category_parent_category_id FOREIGN KEY (parent) REFERENCES category(id); ERROR 1005
I have a computed column created with the following line: alter table tbPedidos add
ALTER TABLE LAB_ADMIN_USER.TEST_TEMPLATE_ABBR ADD ( CONSTRAINT TEST_TEMPLATE_ABBR_R01 FOREIGN KEY (test_template_id) REFERENCES LAB_ADMIN.TEST_TEMPLATE (test_template_id) ON
I want to run this on my table: ALTER TABLE table_name MODIFY col_name VARCHAR(255)
I have a function that searches a database table via ajax. This is the
I am trying to add following constraint to my DB2 table but it gives
When you do an ALTER TABLE <name> You can use ALTER COLUMN so you
I'm trying to do ALTER table tbl_name Engine=MyISAM; and I get ERROR 1217 (23000):

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.