You have a column that will only contain values from 0 to 256. What is the most economical data type to be used for the column?

Options
- TINYINT
- SMALLINT
- INT
- DECIMAL(1)


CORRECT ANSWER : SMALLINT

Discussion Board
SQL SERVER

Correct Answer: B. SMALLINT

Explanation:

- In the above question, we are given that a column contains values from 0 to 256, so the correct answer is SMALLINT, because a SMALLINT data type uses only 2 bytes of data and can store values from -32,768 to 32,767.

- A TINYINT data type cannot be used because the maximum value it can hold is 0 to 255 and it has 1 byte storage capacity.

- Although an Integer data type can be used, SMALLINT will use only 2 bytes compared to Integer's 4 bytes, VARHCAR (3) will use 3 3 bytes while DECIMAL.


Prajakta Pandit 03-8-2016 01:49 AM

Incorrect Answer

Answer to Question in link "http://www.careerride.com/question-19-Sql-server-3"

should be Tinyint not Small int
https://msdn.microsoft.com/en-IN/library/ms187745.aspx


Avik 02-29-2016 09:46 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement