After creating the database, you can start adding tables to it with the
command.In creating a table, you have to specify the data type of each field. SQL includes several datatypes, although it is less rich than Paradox and other local databases. Table 11.1 lists SQLstandard data types and some other types available on most servers.
The Data Types Used by SQL
Data Type Standard Usage
Yes Indicates a string of
characters. Specific servers ordrivers can impose a length limit (32,767 charactersfor InterBase).
Yes An integer number, usually four bytes but platformdependent.
Yes A smaller integer number, generally two bytes.
Yes A floating-point number.
Yes A high-precision floating-point number.
Yes A floating-point number, with the indicated precisionand scale.
No A date. Implementation of this data type varies fromserver to server.
No An object that holds a large amount of binary data(BLOB stands for binary large object).
No A variable-size string used to avoid the space con-sumption of a fixed large string.
class in Delphi can distinguish between
types, indicat-ing the actual type in a property and fixing some the problems of using a
that’s notpadded with trailing spaces in the
clause of an
Programmers who are used to Paradox and other local engines will probably notice theabsence of a logical or Boolean type, of date and time fields (the
type in InterBase holdsboth date and time), and of an AutoInc type, which offers a common way to set up a uniqueID in a table. The absence of a logical type can create a few problems when upsizing an exist-ing application. As an alternative, you can use a
field with 0 and 1 values for Trueand False, or you can use a domain, as explained in the next section. An AutoInc type is pre-sent in some servers, such as Microsoft SQL Server, but not in InterBase. This type can bereplaced by the use of a generator, as discussed in the book.
SQL: The Data Definition Language
Copyright ©2001 SYBEX, Inc., Alameda, CAwww.sybex.com