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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:33:02+00:00 2026-05-30T03:33:02+00:00

Basically, I have a table called document which contains a column named as host.

  • 0

Basically, I have a table called document which contains a column named as “host”. I have created another column named as “rev_host” and all I want is to store the reversed strings from “host” to “rev_host”. For example, if the “host” value is “www.cmu.edu”, I want to save “ude.umc.www” to “rev_host”. I then use a statement

INSERT INTO document (rev_host) SELECT REVERSE(host) from document;

This statement throws the 1062 error:

ERROR 1062 (23000): Duplicate entry '' for key 2

What is the problem of this statement? If I cannot insert in this way. What is the right way to perform this insertion?

  • 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-30T03:33:04+00:00Added an answer on May 30, 2026 at 3:33 am

    Your query inserts a whole bunch of new lines in the table, thereby introducing duplicate keys. if you want to update just one column and keep your previous entries use UPDATE instead:

    UPDATE document SET rev_host=REVERSE(host);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table called propAmenities which holds two column amenity_id and property_id basically
i have a table called propAmenities which holds two column amenity_id and property_id basically
I have a table called Billing , which is basically a receipt (for different
So, basically, I have a MySQL table called 'topics' and another one called 'replies',
i have a table that somehow got duplicated. i basically want to delete all
Basically I have a table which is used to hold employee work wear details.
Can we have a SQL query which will basically help in viewing table and
Basically, I have multiple URL's stored in a MySQL table. I want to pull
Hope my subject line was descriptive enough. Basically, I have a table called Students,
Basically I have a field in my table called sex, and it's a boolean.

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.