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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:44:45+00:00 2026-05-12T13:44:45+00:00

I noticed after running, DELETE FROM tablename My ID (auto increment) values became weird

  • 0

I noticed after running,

DELETE FROM tablename

My ID (auto increment) values became weird

7, 8, 9, 0, 1, 12, 3, 4, 15 

In this order when I do a,

SELECT * FROM tablename

I know that the certification guide says that IDs may or may not be reset when DELETE without WHERE is used to empty a table, but what caused the ID sequence to be so weird? I am quite certain that’s the order the rows were inserted. Originally before delete I had 6 rows in the table so 7, 8, 9 seems understandable .

  • 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-12T13:44:45+00:00Added an answer on May 12, 2026 at 1:44 pm

    in reference to your screen shots:http://img19.imageshack.us/img19/7336/82051321.png and http://img27.imageshack.us/img27/2935/24285862.png

    the problem is with your “application code”. you’re using LOAD DATA INFILE with a file that has windows style (\r\n) line endings, and the default in mysql unless you specify otherwise is unix style (\n).

    to see what i mean, try this:

    mysql> load data infile 'data.txt' into table testDel (val);
    Query OK, 6 rows affected (0.01 sec)
    Records: 6  Deleted: 0  Skipped: 0  Warnings: 0
    
    mysql> select * from testDel;
    +----+----------------+
    | id | val            |
    +----+----------------+
     | 7 | hello world 1
     | 8 | hello world 2
     | 9 | hello world 3
     | 0 | hello world 4
     | 1 | hello world 5
    | 12 | hello world 6  |
    +----+----------------+
    6 rows in set (0.00 sec)
    
    mysql> select id, hex(val) from testDel;
    +----+------------------------------+
    | id | hex(val)                     |
    +----+------------------------------+
    |  7 | 68656C6C6F20776F726C6420310D |
    |  8 | 68656C6C6F20776F726C6420320D |
    |  9 | 68656C6C6F20776F726C6420330D |
    | 10 | 68656C6C6F20776F726C6420340D |
    | 11 | 68656C6C6F20776F726C6420350D |
    | 12 | 68656C6C6F20776F726C642036   |
    +----+------------------------------+
    6 rows in set (0.01 sec)
    

    what’s happening is the \r is clobbering the display of your values. did you notice how your tables “walls” don’t line up? this should be a hint that something is wrong with the display, as evidenced by the query with hex(val) where the “walls” do line up.

    to fix the import, you have to specify the line endings in the file:

    mysql> load data infile 'data.txt' into table testDel lines terminated by '\r\n' (val);
    Query OK, 6 rows affected (0.00 sec)
    Records: 6  Deleted: 0  Skipped: 0  Warnings: 0
    
    mysql> select * from testDel;
    +----+---------------+
    | id | val           |
    +----+---------------+
    | 13 | hello world 1 |
    | 14 | hello world 2 |
    | 15 | hello world 3 |
    | 16 | hello world 4 |
    | 17 | hello world 5 |
    | 18 | hello world 6 |
    +----+---------------+
    6 rows in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.