Databases Reference
In-Depth Information
5.3 Implementing Database Objects
Physically implementing the database objects is one of the major milestones in
solution deployment that you've been working toward. First you create the data-
base, and then you create the database objects you need to support the solution.
The three most basic database objects in any database design are tables, indexes,
and views, so that is where we'll focus our attention.
As part of this discussion, we will introduce three SQL language DDL com-
mands: CREATE TABLE, CREATE INDEX, and CREATE VIEW. Each of these
commands supports a large number of options and command parameters, but
we're going to limit ourselves to using the commands in their most basic forms
as a way of starting the implementation process.
5.3.1 Implementing Your Final Table Design
We've picked apart the concept of table design as much as we can for now. Sooner
or later you get to the point where you have to put up or shut up. In other words,
you have to prove your design by putting it into use.
You create your database tables based on your conversions from the E-R
models and any additional physical design changes you've made. Each table
must have a unique name, usually something easily recognizable and easy to
remember. Attributes become table columns. Each column must also have a
name. Columns names must be unique in the context of the table: each table
column must have a unique name, but you can reuse the same column name
in different tables.
You must also specify the data type for each column. Once again, you have
to make physical design decisions. The data type must be appropriate to the data
the column will contain. You will usually want to choose a data type that min-
imizes storage requirements. For example, you will usually have multiple choices
for storing integer data. The differences between the choices are the maximum
value that you can store and the storage space required. The larger the maxi-
mum value, the more space you need.
Some data types can be fixed or variable length. Fixed length data types
always require the same amount of storage space. For character data, they use
one byte per character for ASCII data types and two bytes per character for Uni-
code data types, whether or not all of the characters are used or even if there is
any data at all in the column. ASCII, the American Standard Code for Infor-
mation Interchange, is an encoding standard for encoding English language
characters and control characters. Unicode is a universal writing system encod-
ing system capable of encoding any written language. With variable-length data
types you set the maximum column size, but the space used is based on the
actual data stored in the columns.
Search WWH ::




Custom Search