PostgreSQL

Скачать в pdf «PostgreSQL»
8.8 Summary


This chapter has described how to combine queries in ways you probably never anticipated. It showed how queries could be chained and placed inside other queries. In addition, it demonstrated how update can use from, and how select can create tables.


Although these features may seem confusing, they are very powerful. In most cases, you will need only the simplest of these features. However, you may get that rare request that requires one of the more complicated queries covered in this chapter. If you recognize such a query, return to this chapter to refresh your memory.

Chapter 9

Data Types


Data types have been used in previous chapters. This chapter covers them in detail.

9.1 Purpose of Data Types


It is tempting to think that databases would be easier to use if only one data type existed—a type that could hold any type of information, such as numbers, character strings, or dates. Although a single data type would certainly make table creation simpler, having different data types offers definite advantages:


Consistent Results Columns of a uniform type produce consistent results. Displaying, sorting, aggregates, and joins deliver consistent results. No conflict arises over how different types are compared or displayed. For example, selecting from an integer column always yields integer values.


Data Validation Columns of a uniform type accept only properly formated data; invalid data are rejected. For example, a column of type integer will reject a date value.


Compact Storage Columns of a uniform type are stored more compactly.


Performance Columns of a uniform type are processed more quickly.

Скачать в pdf «PostgreSQL»