1.

If an integer column is used for the values in range 1 to 99999, the best suitable datatype is ____________(a) MEDIUMINT SIGNED(b) MEDIUMINT UNSIGNED(c) SMALLINT SIGNED(d) SMALLINT UNSIGNEDThe question was posed to me at a job interview.This key question is from Choosing Data Types topic in section Data Types of MySQL

Answer»

The correct CHOICE is (b) MEDIUMINT UNSIGNED

To elaborate: Since the range starts from the positive value 1, it is best to KEEP the DATATYPE as UNSIGNED. The maximum value is of the order of 10^5, so a MEDIUMINT datatype is WELL suited.



Discussion

No Comment Found

Related InterviewSolutions