Sample Table Design Sketch

A table called friends_etc is used to illustrate how to create indexes, defaults, rules, triggers, and so forth.

friends_etc hold names, addresses, telephone numbers, and personal information. It does not define any column defaults or integrity constraints.

If another user has already created the friends_etc table, check with a system administrator or the database owner if you plan to follow the examples and create the objects that go with friends_etc. The owner of friends_etc must drop its indexes, defaults, rules, and triggers so that there is no conflict when you create these objects.

This table shows the proposed structure of the friends_etc table and the indexes, defaults, and rules that go with each column.

Column

Datatype

Null?

Index

Default

Rule

pname

nm

NOT NULL

nmind(composite)

sname

nm

NOT NULL

nmind(composite)

address

varchar(30)

NULL

city

varchar(30)

NOT NULL

citydflt

state

char(2)

NOT NULL

statedflt

zip

char(5)

NULL

zipind

zipdflt

ziprule

phone

p#

NULL

phonerule

age

tinyint

NULL

agerule

bday

datetime

NOT NULL

bdflt

gender

bit

NOT NULL

gndrdflt

debt

money

NOT NULL

gndrdflt

notes

varchar(255)

NULL