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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:08:04+00:00 2026-05-15T05:08:04+00:00

I need something real simple, that for some reason I am unable to accomplish

  • 0

I need something real simple, that for some reason I am unable to accomplish up to this point.

I have also been unable to Google the answer surprisingly. I need to number the entries in different tables uniquely. I am aware of AUTO INCREMENT in MySQL and that it will be involved. My situation would be as follows:

If I had a table like

Table EXAMPLE

   ID - INTEGER
   FIRST_NAME - VARCHAR(45)
   LAST_NAME - VARCHAR(45)
   PHONE - VARCHAR(45)
   CITY - VARCHAR(45)
   STATE - VARCHAR(45)
   ZIP - VARCHAR(45)

This would be the setup for the table where ID is an integer that is auto-incremented every time an entry is inserted into the table. The thing I need is that I do not want to have to account for this field when inserting data into the database. From my understanding this would be a surrogate key, that I can tell the database to automatically increment and I do not have to include it in the INSERT STATEMENT

So, instead of:

 INSERT INTO EXAMPLE VALUES (2,'JOHN','SMITH',333-333-3333,'NORTH POLE'....

I can leave out the first ID column and just write something like:

INSERT INTO EXAMPLE VALUES ('JOHN','SMITH'.....etc)

Notice I wouldn’t have to define the ID column…

I know this is a very common task to do, but for some reason I cant get to the bottom of it.

I am using MySQL, just to clarify.

Thanks a lot

  • 1 1 Answer
  • 1 View
  • 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-15T05:08:05+00:00Added an answer on May 15, 2026 at 5:08 am

    This:

    INSERT INTO EXAMPLE VALUES ('JOHN','SMITH'.....etc)
    

    …will return a MySQL Error #1136, because the number of columns in the table do not match the number of columns specified in the VALUES clause. So you have two options:

    1. Use NULL to fill in the autoincrement column value. IE:

      INSERT INTO EXAMPLE VALUES (NULL, 'JOHN','SMITH'.....etc)
      
    2. Specify the list of columns for the table that values are being provided for. IE:

      INSERT INTO EXAMPLE 
        (FIRST_NAME, LAST_NAME, PHONE, CITY, STATE, ZIP)
      VALUES 
        ('JOHN','SMITH'.....etc)
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need something simple; I have page where a user clicks an author to
I need something like this http://jonraasch.com/blog/a-simple-jquery-slideshow but w/o the absolute positioning. Is it possible?
This seems so tricky to me that I think I am overlooking something simple
I need something simple like date , but in seconds since 1970 instead of
Ok, I need something like this: datediff(second, date_one, date_two) < 1 dates are stored
How can I create a barcode image in Java? I need something that will
My question is probably very simple but it could also be the case that
I need to create what I think should be a simple GUI. I have
Real Dumb question. I figured I would have gotten this straight by now, but
Hell everyone. I need some help with a ruby script that I am writing

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.