中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

3.1.1 Database Systems: Basic Structure

3.1.1 Basic Structure

1. Figure 3.1 shows the deposit and customer tables for our banking example.

  • It has four attributes.
  • For each attribute there is a permitted set of values, called the domain of that attribute.
bname account# cname balance

Downtown

Lougheed Mall

SFU

SFU

101

215

102

304

Johnson

Smith

Hayes

Adams

500

700

400

1300

 

cname street ccity

Johnson

Smith

Hayes

Adams

Jones

Pender

North

Curtis

No.3 Road

Oak

Vancouver

Burnaby

Burnaby

Richmond

Vancouver

Figure 3.1: The deposit and customer relations.

  • E.g. the domain of bname is the set of all branch names.

Let D1 denote the domain of bname, and D2, D3 and D4 the remaining attributes' domains respectively.
Then, any row of deposit consists of a four-tuple (v1, v2, v3, v4) where
v1∈D1; v2∈D2; v3∈D3; v4∈D4
In general, deposit contains a subset of the set of all possible rows.
That is, deposit is a subset of
D1×D2×D3×D4; or; abbreviated to; ×4i=1Di
In general, a table of n columns must be a subset of

×ni=1Di (all possible rows)

2. Mathematicians define a relation to be a subset of a Cartesian product of a list of domains. You can see the
correspondence with our tables.
We will use the terms relation and tuple in place of table and row from now on.

3. Some more formalities:

  • let the tuple variable t refer to a tuple of the relation r.
  • We say t 2 r to denote that the tuple t is in relation r.
  • Then t[bname] = t[1] = the value of t on the bname attribute.
  • So t[bname] = t[1] = \Downtown",
  • and t[cname] = t[3] = \Johnson".

4. We'll also require that the domains of all attributes be indivisible units.

  • A domain is atomic if its elements are indivisible units.
  • For example, the set of integers is an atomic domain.
  • The set of all sets of integers is not.
  • Why? Integers do not have subparts, but sets do | the integers comprising them.
  • We could consider integers non-atomic if we thought of them as ordered lists of digits.

 

Figure 3.2: E-R diagram for the banking enterprise

Database System Structure: