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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:59:08+00:00 2026-06-16T00:59:08+00:00

Here is the sql, however, there is an error says *#1061 – Duplicate key

  • 0

Here is the sql, however, there is an error says “*#1061 – Duplicate key name ‘unique_id’* “, what is the problem.

create table `users`(
   uid int(11) auto_increment,
   unique_id varchar(23) not null unique,
   name varchar(50) not null,
   email varchar(100) not null unique,
   encrypted_password varchar(80) not null,
   salt varchar(10) not null,
   created_at datetime,
   updated_at datetime null,
  PRIMARY KEY (`unique_id`),
  UNIQUE KEY `uid` (`uid`),
  UNIQUE KEY `unique_id` (`unique_id`),
  UNIQUE KEY `email` (`email`)
)ENGINE=InnoDB AUTO_INCREMENT=877888 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  • 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-16T00:59:10+00:00Added an answer on June 16, 2026 at 12:59 am

    remove this line

    UNIQUE KEY `unique_id` (`unique_id`),
    

    since unique_id is already Primary Key. and Primary Keys are unique.

    full CREATE TABLE statement

    create table `users`
    (
       uid int(11) auto_increment,
       unique_id varchar(23) not null,
       name varchar(50) not null,
       email varchar(100) not null unique,   -- specified here
       encrypted_password varchar(80) not null,
       salt varchar(10) not null,
       created_at datetime,
       updated_at datetime null,
       PRIMARY KEY (`unique_id`),
       UNIQUE KEY `uid` (`uid`)
    )  ENGINE=InnoDB AUTO_INCREMENT=877888 
    DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    
    • SQLFiddle Demo
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my sql: CREATE TABLE companyprinciple { userid INT, FOREIGN KEY (userid) REFERENCES
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
There is good answer here: https://stackoverflow.com/a/1610530/630169 However if updated table have a trigger that
SQL novice here. I'm trying to get a list of invoice numbers. There are
Here is my problem with simplified example. I have two entities modeled from SQL
When I'm trying to create various table for a project via an import sql,
We are getting this error on a table in our database: Cannot create a
Possible Duplicate: SQL Server: Is there an “IF EXISTS” test for a linked server?
This question already has an answer here: view sql that linq-to-sql produces 3 Answers
I am new to SQL Server 2008 fill factor, as mentioned here in SQL

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.