No products in the cart.

Differentiate with print CHAR and VARCHAR.

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

Differentiate with print CHAR and VARCHAR.
  • 1 answers

Yogita Ingle 4 years, 2 months ago

CHAR and VARCHAR are both ASCII character data types and almost same but they are different at the stage of storing and retrieving the data from the database. Following are some important differences between CHAR and VARCHAR in MySQL −

CHAR Data Type

VARCHAR Data Type

Its full name is CHARACTER Its full name is VARIABLE CHARACTER
It stores values in fixed lengths and are padded with space characters to match the specified length VARCHAR stores values in variable length along with 1-byte or 2-byte length prefix and are not padded with any characters
It can hold a maximum of 255 characters. It can hold a maximum of 65,535 characters.
It uses static memory allocation. <pre> mysql>create table emp(name CHAR(20)); Query OK, 0 rows affected (0.25</pre> It uses dynamic memory allocation. <pre> mysql>create table emp1(name VARCHAR(20)); Query OK, 0 rows affected (0.21</pre>
http://mycbseguide.com/examin8/

Related Questions

Founder of python
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App