Figure 212 A single database can contain two tablesin this case

phonebook and

[View full size image]

last name

first name

phone

Doe

John

555-555-1212

Doe

Jane

555-555-1212

Palmer

John

555-123-4567

Johnson

Richard

555-111-4321

cd col feci i on

id

title

artist

year

rating

1

Mmdhnmh

The The

4

2

For AN You've Done

Hillsong

2004

3

Tfouser Jazz

Mr Scruft

2002

5

4

Natural Elements

Acoustic Alchemy

1930

3

5

Combat Rock

The Cfash

19B2

4

6

Life lor Rent

Dido

2003

5

7

Ad ¬°emus 4

Karl Jenkins

2000

4

&

The Two Towers

Howard Shore

£002

5

In the sampie_database example, the phonebook table contains four records (rows) and each record hold three fields (columns) of data. The cd_coiiection table holds eight records, divided into five fields of data.

If you are thinking that there is no logical relationship between the phonebook table and the cd_coiiection table in the sampie_database example, you are correct. In a relational database, users can store multiple tables of data in a single databaseeven if the data in one table is unrelated to the data in others.

For example, suppose you run a small company that sells widgets and you have a computerized database of customers. In addition to storing each customer's name, address, and phone number, you want to be able to look up outstanding order and invoice information for any of your customers. You could use three related tables in an RDBMS to store and organize customer data for just those purposes. Figure 21.3 shows an example of such a database.

Was this article helpful?

0 0

Post a comment