I'm having trouble understanding what is meant by fixed length strings and variable length.
Is this right?
When declaring a column and its attributes, you can decide on many data types, 2 of which include char and varchar.
With char, it is for fixed length. So you would declare that fixed length when declaring the column. With varchar, there is no max lenth for a string, just the maximum that varchar supports.
I guess the reasoning is, if you need to input character strings, and you know those strings will never be more than 100 characters, you could chose char, and declare it to be 100 characters in size. That way, when creating the data pages for the table rows, the db only needs to allocate enough memory to accomodate that max of 100 characters.
But with varchar, the string length could vary greatly, so it just allocates the same maximum space for every row?
Is this right?
When declaring a column and its attributes, you can decide on many data types, 2 of which include char and varchar.
With char, it is for fixed length. So you would declare that fixed length when declaring the column. With varchar, there is no max lenth for a string, just the maximum that varchar supports.
I guess the reasoning is, if you need to input character strings, and you know those strings will never be more than 100 characters, you could chose char, and declare it to be 100 characters in size. That way, when creating the data pages for the table rows, the db only needs to allocate enough memory to accomodate that max of 100 characters.
But with varchar, the string length could vary greatly, so it just allocates the same maximum space for every row?
