ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

In MyISAM tables, when a table is emptied with the TRUNCATE TABLE, the counter begins at . . . . . . . .

Answer & Solution
Correct Answer: Option B
This question is about how MySQL handles the auto-increment counter in MyISAM tables when you use the `TRUNCATE TABLE` command.

The `TRUNCATE TABLE` command is used to delete all rows from a table.

In MyISAM tables, the auto-increment counter is a special value that helps MySQL assign unique IDs to new rows. When you add a new row, the counter is increased by 1, and the new row gets the current value of the counter.

The question asks what happens to the counter when you use `TRUNCATE TABLE`.

The answer is Option A: 0

When you truncate a table, MySQL resets the auto-increment counter to 0. This ensures that when you start adding new rows again, they will receive unique IDs starting from 1.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.