This question asked in CBSE SQP-2020

Which declaration doesn’t use the same number of bytes and consumption of bytes depend on the input data?

 

Answer:

The varchar declaration doesn’t use the same number of bytes and consumption of bytes depends on the input data. 

Explanation: 

Varchar is a datatype in SQL which is used to store character strings of variable length but with maximum length specified. If the length of the string is less than the set length then it will store the string as it is without adding any extra blank spaces.

 

Example:

Declaration

Value assigned 

Number of Bytes

Consumption of Bytes

Name varchar(10)

‘Rosa’

10

4

Place varchar(15)

‘Chandigarh’

15

10

 

 

Go Ad-free

Transcript

This question asked in CBSE SQP-2020 Which declaration doesn’t use the same number of bytes and consumption of bytes depend on the input data? Answer: The varchar declaration doesn’t use the same number of bytes and consumption of bytes depends on the input data. Explanation: Varchar is a datatype in SQL which is used to store character strings of variable length but with maximum length specified. If the length of the string is less than the set length then it will store the string as it is without adding any extra blank spaces. Example: Declaration Value assigned Number of Bytes Consumption of Bytes Name varchar(10) ‘Rosa’ 10 4 Place varchar(15) ‘Chandigarh’ 15 10

Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo