Databases
Tom Kelliher, CS14A
Apr. 14, 1997
Friday's quiz: e-mail me a memo telling me if I can afford a certain car.
I'll tell you:
- What I can afford per month.
- My monthly gasoline bill.
- My annual insurance bill.
- The price of the car.
- My down payment.
- The annual interest rate and length of the auto loan.
You will use a spreadsheet (from scratch with closed books) to determine if
I can afford the car. You will paste (not special paste) the spreadsheet
into your memo (Word document) and e-mail that to me.
What is a database? Organized collection of information.
What are operations associated with a database?
- Store information.
- Organize information.
- Retrieve information.
Two types of databases:
- File management system --- single file.
- Database management system --- multiple files, relationships between
files.
How would an individual use a database?
How would an organization use a database?
Is the World Wide Web a database?
What are the impacts upon society?
- File --- Usually a binary file in a proprietary format. Contains
records.
- Record --- Information about one ``entity.'' Contains fields.
- Field --- One ``bit'' of information about an entity.
Abstract view of a database:
Note: each record has same number of fields.
Catalog of CDs:
- One record for each CD.
- Fields:
- Title.
- Artist.
- Year.
- Type (alternative, classical, jazz, etc.)
- Label.
- Track number.
- Track title.
- Order number.
Can we put all the track titles into one record?
- Flat file systems.
- Single file databases.
- No linking to other files.
- Only one ``view.''
- Redundancy (consider CD example).
- Redundant (repeated) data leads to data integrity problems.
- Relational database.
- Multiple files.
- Relationships between files.
- Relational model:
- Entity.
- Relationship.
- Key field (sometimes multiple fields).
- Redundancy elimination. Why is redundancy bad?
Design a relational database for the Registrar.
Important data:
- Students. What fields? What's the key field?
- Faculty. What fields? Key field?
- Classes. What fields? Key field?
- What relational files?
Example Queries (view):
- Student: phone number, home address, current classes.
- Faculty member: e-mail, current classes, current students.
- Class: title, enrollment limit, current enrollment, instructor,
students.
Thomas P. Kelliher
Sat Apr 12 17:10:12 EDT 1997
Tom Kelliher