Data Types
- If an integer column is used for the values in range 1 to 99999, the best suitable datatype is ____________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
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.
- Which of these values is not valid as an AUTO_INCREMENT value?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
In MySQL, the ‘AUTO_INCREMENT’ values are a sequence of unique values assigned to the columns such that they increase monotonically. They begin with the value 1 and increment by a unit.
- AUTO_INCREMENT columns must be NOT NULL.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The ‘AUTO_INCREMENT’ columns must be NOT NULL. If the NOT NULL is omitted, MySQL adds it automatically. AUTO_INCREMENT column values begin with 1 and increase monotonically after it.
- Which of these types store the longest length of strings?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
In MySQL, the different string datatypes are used to store different lenghts of the string. Here, the length would refer to the number of characters in the string. TEXT stores longer strings.
- If a column is expected to store values up to 2 million, the best datatype for it is _____________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The different numeric types used in MySQL are used to store different range of values. To store values of the order of a million, the MEDIUMINT or BIGINT datatype is sufficient.