Advertisements
Advertisements
Question
In a table in the MYSQL database, an attribute A of datatype varchar(20) has the value “Keshav”. The attribute B of datatype char(20) has the value “Meenakshi”. How many characters are occupied by attribute A and attribute B?
Options
20,6
6,20
9,6
6,9
MCQ
Advertisements
Solution
6,20
Explanation:
Keshav has a 6-character length. Varchar is known to have a changeable length. Therefore, even if the field's width is 20, it will only use the characters' total length. Rather, char has a set length. Regardless of the number of characters in the actual data, it will take up the entire number of characters set aside for the field.
shaalaa.com
Data Types and Constraints in MySQL
Is there an error in this question or solution?
