Char vs Varchar in SQL

Char |
VarChar |
| Char data type is used for storing single character values | It is a SQL Code that helps in storing variable character |
| Used to store characters string of fixed length specified | If a length of a string is less than the set or fixed length then it will store as it is without including any extra blank spaces.
|
| Size is fixed. Cannot be changed during runtime | Storage size of VARCHAR datatype is equal to the actual length of the entered string in bytes.
|
| Can Store only characters | We should use this datatype when we expect the data values in a column are of variable length.
|
| Memory is allocation is Static | Memory is allocated Dynamically |
| Per Character contains 1 byte | For Storing it uses 1 byte per character Plus 1 or 2 extra bytes for stroing varying length. |
| Since the size of the char is fixed and cannot be changed, there will be a memory wastage.
|
To store a character string value of set length then varchar data type is used |