1

Different databases use different naming conventions for variable-length string datatypes. VARCHAR(n) or TEXT(n) are common naming formats for variable-length strings. Figure 3-6 shows variable-length strings on country names (COUNTRY), returning only the names of the countries and no padding out to maximum length as for fixed-length strings.

How should I understand out in the last sentence?

3 Answers 3

1

In addition to the correct answers given already it might be worth seeing an example of a padded out string, in a database context.

A variable length string, defined as VARCHAR(10) and populated with ITALY would return a string of length 5 containing the characters I T A L Y. When treated as an array the variable length string would be char[5]

A fixed length string, declared as CHAR(10) and populated with ITALY would return a string of length 10 containing the characters I T A L Y _ _ _ _ _ (where here on StackEchange I need to use '_' to denote a space). When treated as an array the fixed length string would be char[10].

With data like COLUMBIA the variable length string would be C O L O M B I A while the fixed length string would be C O L O M B I A _ _

The fixed length string has been padded out with spaces at the end to ensure that it always takes up the defined number, in this case 10, of characters.

Many databases will allow you to use a function such as TRIM(yourString) to remove the padding spaces.

In both cases the maximum number of characters is adhered to so UNITED KINGDOM would be saved as U N I T E D _ K I N . VARCHAR(max) or similar allows almost any size variable length string to be stored without truncation.

1

Definition 5 applies:

out : 5. To the end; completely.

It's saying that VARCHAR does not require strings to be padded with spaces or extra characters to the end (to the maximum length) because they are variable length.

1

In this case, it means "to completion". (A fixed-length string would have nulls or blanks filling the remainder of the space.)

Another example of that case of "out": build out -- to complete a building project.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .