questions:
1. I read an article on the internet which says:
type of tables must be created as innoDB for generating relationship between them, right?
what does innoDB and other types of tables mean?
2) types of field
what are differences between text, char(..), varChar(..)?
thanks
type of tables for relationship between them
Moderator: General Moderators
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
Abt 2) - String Types
Difference is mainly Storage Requirements
CHAR(M) M bytes, 0 <= M <= 255
VARCHAR(M) L+1 bytes, where L <= M and 0 <= M <= 255
BLOB, TEXT L+2 bytes, where L < 2^16
Difference is mainly Storage Requirements
CHAR(M) M bytes, 0 <= M <= 255
VARCHAR(M) L+1 bytes, where L <= M and 0 <= M <= 255
BLOB, TEXT L+2 bytes, where L < 2^16
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
hi,
thanks for reply.
1. ---------------------------------
further question about field type:
For example, if user inputs "Hello boy" in a field.
bytes used varies with type of the field according to the input
(type, bytes used)
CHAR(50), 50
VARCHAR(50), 9+1=10
TEXT, 9+2=11
is my understanding above correct?
if yes, why people use CHAR rather than VARCHAR very often?
2. ---------------------------------
further question about table type:
question:
does InnoDB use more storages than default table type? - I guees so. why default type of a table is NOT InnoDB, what is its drawback?
thanks for reply.
1. ---------------------------------
further question about field type:
if so, TEXT and VARCHAR are better than CHAR from size of storage's view.anjanesh wrote: CHAR(M) M bytes, 0 <= M <= 255
VARCHAR(M) L+1 bytes, where L <= M and 0 <= M <= 255
BLOB, TEXT L+2 bytes, where L < 2^16
For example, if user inputs "Hello boy" in a field.
bytes used varies with type of the field according to the input
(type, bytes used)
CHAR(50), 50
VARCHAR(50), 9+1=10
TEXT, 9+2=11
is my understanding above correct?
if yes, why people use CHAR rather than VARCHAR very often?
2. ---------------------------------
further question about table type:
question:
does InnoDB use more storages than default table type? - I guees so. why default type of a table is NOT InnoDB, what is its drawback?
Because with VARCHAR your dbms has to calculate the real length each time. Where with CHAR it has a fixed length and doesn't need to calculate the exact record length when navigating through the records...php12342005 wrote: if so, TEXT and VARCHAR are better than CHAR from size of storage's view.
For example, if user inputs "Hello boy" in a field.
bytes used varies with type of the field according to the input
So as usual, it's a choice between calculations <-> memory
In my experience people that use mysql don't care about data integrity. That would explain why they choose myisam and don't care about referential integrity etc..php12342005 wrote: why default type of a table is NOT InnoDB, what is its drawback?