721 views

An attribute $A$ of datatype varchar $(20)$ has value 'Ram' and the attribute $B$ of datatype char $(20)$ has value 'Sita' in oracle. The attribute $A$ has ________ memory spaces and $B$ has _______ memory spaces.

1. $20,20$
2. $3,20$
3. $3,4$
4. $20,4$

1 comment

Is it option 2 ?

The CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved. They also differ in maximum length and in whether trailing spaces are retained.

The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you want to store. For example, CHAR(20) can hold up to 20 characters.

The length of a CHAR column is fixed to the length that you declare when you create the table.

VARCHAR(20) can also hold up to 20 characters... but if cahracter is less.. it will take less space...

so a needs 3 space (for ram)

b needs 20(for sita)

option 2

datatype varchar(20) is variable length maximum can be 20(less than possible depend upon input ) but datatype char(20) is fixed length

datatype varchar (20) has value 'Ram'  it will take 3 memory space(3 letter word) because of variable length

datatype char (20)  has value 'Sita'  it will take 20 memory space because  of fixed length