The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team



Super Learner

In the lecture “String Data Types”. The part in which the instructor is explaining the differences between CHAR and VARCHAR is not clear due to an audio glitch. Please tell me the differences between CHAR and VARCHAR? 
Archisman ( Archie) 

1 Answer

365 Team

Hi Archisman!
Thanks for reaching out.
You’re probably wondering why CHAR exists considering the fact that VARCHAR is a lot more responsive to the data value inserted. Also, VARCHAR would require smaller storage if the value inserted is shorter than the defined maximum size.
The reason is strictly technical and it concerns mainly advanced users. When processing data, CHAR is about 50% faster than VARCHAR. In our course, this contrast in speed will be of no significance, but when professionals must deal with huge amounts of data, such a difference can become important.
Hope this helps.

Hi Martin! So space is one such aspect. But what if a user tries to use a VARCHAR(255) but uses only 4 bits (let’s say uses a four-letter word ABCD). Then it is going to occupy the same space as CHAR(4). Hence, CHAR and VARCHAR are doing the same thing.

5 months

Hi Archisman! I rather think of the difference between CHAR and VARCHAR as an indication of what the data contained in the relevant field is supposed to express. In other words, although in certain situation the two can be interchangeable (from analytical perspective), VARCHAR is generally more optimal in terms of memory usage, as it will not assign an empty character after the 4 characters you are mentioning. The empty character is still counted as a character in a fixed-variable length (i.e. CHAR). Hope this helps. Best, Martin

5 months
Complete Data Science Education
Get 50% OFF