Q1084
What is the best datatype for a column that is expected to store values up to 2 million?
A.
SMALLINT
B.
TINYINT
C.
MEDIUMINT
D.
BIGINT
AnswerAnswer: Option D
Solution
Answer: Option D
Solution:
This question asks about the best data type for a column that will store large numbers, up to 2 million. Let's break down the options:
Option A: SMALLINT: This data type can store integers from -32,768 to 32,767. It's too small for our needs.
Option B: TINYINT: This data type can store integers from -128 to 127. It's also too small for 2 million.
Option C: MEDIUMINT: This data type can store integers from -8,388,608 to 8,388,607. This is still too small for 2 million.
Option D: BIGINT: This data type can store integers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. This is a very large range and will easily accommodate 2 million.
Therefore, the best data type for our column is BIGINT.