Using Sequences


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In the MyISAM tables, whenever a table is truncated with the ‘TRUNCATE TABLE’ clause, the ‘AUTO_INCREMENT’ counter again gets reset. It begins with the value one and increases monotonically.


  1. In a MyISAM table, if the maximum value of an AUTO_INCREMENT increment column is 12 and that row is deleted, the next value generated is _____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In the MyISAM tables, AUTO_INCREMENT sequences normally are monotonic. The values in an automatically generated series are strictly increasing. They are not reused when rows are deleted.



  1. The number of rows in the table is 10. Suppose all rows are deleted. The new row starts with sequence number _____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    When the row containing the largest value in an AUTO_INCREMENT column is deleted, that value is reused the next time a new value is generated. In this case the sequence number is 1.


  1. Suppose the last row has the AUTO_INCREMENT column value 32. Suppose a new row is added by setting AUTO_INCREMENT value equal to 100. The next row added will have value _____________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    If the new value is larger than the current next sequence number, then the sequence is reset to continue with the next value after that for the following rows. In this way, “bumping up” the counter is done.



  1. The ‘LAST_INSERT_ID()’ is tied only to the ‘AUTO_INCREMENT’ values generated during the current connection to the server.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The ‘LAST_INSERT_ID()’ is tied only to AUTO_INCREMENT values that are generated during the current connection to the server. It is not affected by AUTO_INCREMENT tied with the other clients.