Friday 13 November 2020

SQL: character data type

Character data types are used to store either fixed-length (or) variable-length strings.

 

Example 1: char(20) always occupy 20 characters memory. Support if you store only 5 characters, remaining 15 characters memory is occupied with spaces.

 

Example 2: varchar(20) Variable-length string. If your string has only 5 characters, it varchar type consume the memory required to store only 5 characters.

 

Data Type

Description

char

Used to store fixed length character strings. Maximum length of char column is 255 characters.

varchar

Used to store variable length character strings. Maximum length is upto 65,535 characters.

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment