Originally posted by: Kaido
I'm trying to understand basic database structure. Let me see if I got this right:
1. A database is a single file in the system.
2. A table is like a spreadsheet (with rows and columns) within that database.
3. You can have multiple tables within a database, but you still only have one database file in the system.
Is that right or am I missing it completely?
Lose the idea that a db is a single file. High-level concept: "a database is a collection of tables"
A table is
typically like a spreadsheet, w/rows and columns -- but more advanced features can complicate this basic concept a bit.
Typcially, the tables in a database are related to a general system -- like "people, addresses, and phone#'s" or "purchasing, inventory, sales, billing". That's a simplified idea. Implementing a "purchasing" system can be quite involved and encompass many many tables, just for that one system. Then add-in all the tables needed for inventory, sales, etc. -- and then implement relationships between all the different systems.
simple example: Contact-Book
might have 3 tables; PersonTable, AddressTable, PhoneNumberTable
A person could have multiple addresses, and multiple phone#'s.... so there would be a link between one PersonTable record linked to maybe many AddressTable records. Same idea with phone#'s.
The tables might have fields like:
PersonTable:
personID (a unique #) --> points to maybe several records in AddressTable; also PhoneNumberTable
personFirstname, personLastname
personBirthDate
personType (friend, family, business)
AddressTable:
personID (to relate the PersonTable to AddressTable)
addressLine1, addressLine2, addressCity, addressState, addressZip
addressType (home, billing, shipping)
PhoneNumberTable:
personID (to relate the PersonTable to PhoneNumberTable)
phoneNumber
phoneNumberType (cell, work, home)
Even this simple example has some flaws that I'm ignoring (like, multiple work#'s; a business contact who is also a friend, etc)... but i think shows the idea.