Relational Data Types

Relational databases support different data types based on the type of information that you store within a column. These data types not only affect how data is stored on disk, but also, more importantly, how data is compared to each other. For example, if you are comparing two numbers, or two dates, you don’t want to compare them alphabetically. Storage requirements are important as well. You don’t want to reserve 255 bytes of space for the state field of a table, which you know will contain only the two letter abbreviation of a state’s name. Similarly, you don’t want to reserve only five bytes of space for a telephone number, which you know is 10 digits long.

Fortunately, relational databases provide you with a wide assortment ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.