String Data types in MySQL
Notes:
String Data types in MySQL
MySQL Data types: Data types in MySQL
- W.K.T while defining a column in a table; we must mention data type of the column
- Data type indicates which type of data and range of values a column can hold
- Data types in MySQL are mainly divided into 3 types. They are string, numeric and date/time
String Types: textual data
char[(M)]:
- indicates a fixed-length string that is always right-padded with spaces to the specified length
- M indicates length i.e. maximum number of characters a column can hold
- the range of M is 0 to 255
varchar(M):
- indicates a variable-length string. It stores only the characters that you insert
- M indicates maximum number of characters a column can hold
- the range of M is 0 to 255
text[(M)]:
- indicates a string of characters
- M indicates maximum number of characters a column can hold
- the range of M is 0 to 65535
blob[(M)]: binary large object
- indicates a string of bits
- M indicates maximum number of bits a column can hold
- the range of M is 0 to 65535
mediumtext[(M)]:
- indicates a string of characters
- M indicates maximum number of characters a column can hold
- the range of M is 0 to 1,67,77,215
mediumblob[(M)]:
- indicates a string of bits
- M indicates maximum number of bits a column can hold
- the range of M is 0 to 1,67,77,215
longtext[(M)]:
- indicates a string of characters
- M indicates maximum number of characters a column can hold
- the range of M is 0 to 429,49,67,295
longblob[(M)]:
- indicates a string of bits
- M indicates maximum number of bits a column can hold
- the range of M is 0 to 429,49,67,295
Interview Questions: