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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:02:12+00:00 2026-06-09T18:02:12+00:00

I am trying to use the insert ignore statement to put a name in

  • 0

I am trying to use the insert ignore statement to put a name in a database. I do not want to create duplicates, however, the insert ignore statement I use keeps inserting!

The statement is:

INSERT IGNORE INTO firstname(name) VALUES ('Tommy')

My database shows this:

id  |  name
-------------
1      Tommy
2      Tommy
3      Tommy

A couple bits of information for people helping me. My id is my primary key and it is auto incremented.

My guess is that because the new id is created automatically it thinks its a new result! I am not sure how to solve this expcept with a bigger SQL query checking if the name Tommy exists first

Thanks

  • 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-09T18:02:13+00:00Added an answer on June 9, 2026 at 6:02 pm

    It’s because the column name from firstname table is not unique. Try to add unique constraint using this DDL statement,

    ALTER TABLE firstname ADD UNIQUE (name);
    

    then try if it still add duplicate name. Hope it works now 🙂

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

Sidebar

Related Questions

I'm trying to use an SQL insert statement to migrate rows from a table
I'm currently trying to use CMake for cross-compiling. However, CMake seems to ignore the
I am trying to use INSERT IGNORE INTO to add a row to a
I'm trying to use a BULK INSERT statement to populate a large (17-million-row) table
So I am trying to use jQuery to insert data from an ajax call.
I am trying to use a simple MySQL insert query with the parameters in
I'm trying to use jQuery to insert HTML into a table element. I've been
I'm using Mongoid for a project and am trying to use the batch insert
I am trying to use a dict to do a SQL INSERT . The
'43.005895','-71.013202' Trying to use: INSERT INTO table(fanDetLocZip, fanDetLocCity, fanDetLocState, fanDetLocLat, fanDetLocLong, fanDetLocTZ, fanDetLocDST) VALUES(00210,

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.