The mechanics of creating a table are relatively straight
forward. Being able to design a well thought out database that
will scale to meet the needs of a large scale enterprise is a
very challenging undertaking. In these examples we will be
working through development of a fairly simple three table
database. In doing so we will get to cover a good deal of the
development basics for creating tables and indexes. CREATE TABLE
IF NOT EXISTS person ( num INT(11) NOT NULL DEFAULT 0 ,
firstname VARCHAR(20) NULL , gender_code CHAR(1) NULL ,
birth_dttm DATETIME NULL , inactive_date DATETIME NULL ,
lastname VARCHAR(30) NULL , PRIMARY KEY (num) ) ENGINE = MYISAM
GO CREATE TABLE IF NOT EXISTS phone ( person_num INT(11) NOT
NULL DEFAULT 0 , type_code CHAR(3) NOT NULL , area_code CHAR(3)
NULL , exchange CHAR(3) NULL , extension CHAR(4) NULL , PRIMARY
KEY (person_num, type_code) ) ENGINE = MYISAM GO CREATE TABLE IF
NOT EXISTS address ( person_num INT(11) NOT NULL DEFAULT 0 ,
type_code CHAR(4) NOT NULL , street1 CHAR(30) NU