Chemistry Reference
In-Depth Information
In the above example, Name and Formula are text and MW, logP, and MP
are numeric. The order of the columns is fixed once it is specified when
the table is created. The rows, however, are independent of each other.
There is no inherent internal order in which rows are stored in a
table, regardless of the order in which they were inserted. When rows are
selected, however, the order in which they are ret urned can be specified by
sorting or other operations. If rows are selected without specific ordering
instructions, the order is undefined and may change each time the rows
are selected. An application must never rely on having the rows in a table
returned in the same order, even if an ordering operation is performed.
For example, it may be that the row for Phenobarbital is followed by the
row for Phenobarbitone when the rows are sorted alphabetically by name.
But if a row for Phenobarbitol is ever added to the table, it will appear after
Phenobarbital when the selected rows are sorted by name.
2.3 External and Internal Representations of Data
A data type is necessary to allow the RDBMS to accurately convert the
data from an external representation, most often text in a file, to an inter-
nal representation of the data. For example, the external representation
of a numeric value is a text string containing at least one numeral, and
possibly a plus or minus sign or a decimal point. A text value may contain
any valid text character, usually only printable characters from the ASCII
set. The internal representation of the data is dependent upon the par-
ticular RDBMS and hardware being used. It is not necessary to know the
exact internal representation of the data. The important thing to consider
is which data type accurately represents the data for your purposes.
There are rules governing the conversion from the external representa-
tion. These prevent improper data from being stored in the database. This
is an important advantage over data stored in a typical computer file. It
makes it impossible to store a nonnumeric value in a numeric column. For
example, if a column is defined as numeric, an error would occur if the
string “>2.97” were attempted to be inserted into that column of the table.
Another advantage of enforcing these rules is that operations on the data
in the columns can rely on the correct type of the data, not having to take
special measures to handle nonconforming values. This applies to opera-
tions using SQL or operations performed by an external program that has
selected data from the table. This data type concept will become especially
important when new molecule data types are introduced in Chapter 7.
The internal representation of data is not entirely unimportant. When
the float data type is used, the data are typically converted to the internal
floating-point representation used by the computer on which the RDBMS
is installed. This may have unintended consequences because of the
rounding that occurs, especially if several mathematical operations are
Search WWH ::




Custom Search