Sams Teach Yourself SQL in 24 Hours

Sams Teach Yourself SQL in 24 Hours

By Ron Plew and Ryan Stephens

Q&A

  1. How is it that I can enter numbers such as a person's Social Security number in fields defined as character fields?

    Numeric values are still alphanumeric, which are allowed in character data types. Typically, the only data stored as numeric values are values used in computations. However, it may be helpful for some to define all numeric fields with a numeric data type to help control the data entered in that field.

  2. I still do not understand the difference between constant-length and varying-length data types. Can you explain?

    Say you have an individual's last name defined as a constant data type with a length of 20 bytes. Suppose the individual's name is Smith. When the data is inserted into the table, 20 bytes are taken, 5 for the name and 15 for the extra spaces (remember that this is a constant-length data type). If you use a varying-length data type with a length of 20 and inserted Smith, only 5 bytes of space are taken.

  3. Are there limits on the lengths of data types?

    Yes, there are limits on the lengths of data types and they do vary among the various implementations.

Share ThisShare This

Informit Network