1 cs u430: database design spring 2006 panfeng (tony) zhou
TRANSCRIPT
![Page 1: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/1.jpg)
1
CS U430: Database Design
Spring 2006Panfeng (Tony) Zhou
![Page 2: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/2.jpg)
2
Who am I?
PhD student in Database research area
10 years experiences in DB application development
12 industry world projects in Finance, Education, Health Insurance, Manufacture, etc
![Page 3: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/3.jpg)
3
What could you learn from this course?
You will understand the structure of DBMS and DB language (SQL).
You will learn the index methods of database.
You will learn how to implement a web application from scratch.
![Page 4: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/4.jpg)
4
Main content of the course
Basic structure of DBMS Queries the database Create/Update table content/structure Design the database (ER model) Web interface for database A project that covers all contents in the
course and you can implement a DBMS from scratch
![Page 5: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/5.jpg)
5
Main content of today
1. Introduction to DBMS 2. Relational rules 3. Sample database
![Page 6: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/6.jpg)
6
1.1 Database is everywhere
Shop at supermarket (e.g., Stop&Shop, etc).
Shop online (e.g., www.amazon.com).
Borrow book from library. ………..
![Page 7: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/7.jpg)
7
1.2 Structure of web DBMS
Webbrowser
Webserver
Databases and DBMS
Structured Query Language(SQL)
![Page 8: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/8.jpg)
8
1.3 Products for each components
Component Products
Brower IE, Firefox, etc
Web Server MS IIS, Apache, Resin, etc
DB Server Oracle, DB2, MySQL, MS SQL, MS Access, etc
Operating System
MS Window, Linux, Sun Solaris, etc
Programming language
MS ASP, Java, PHP, etc.
![Page 9: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/9.jpg)
9
1.4 What inside the database? A set of tables. Each table “is” a spread sheet.
Staff_ID F_name L_name Position Gender DOB Salary Branch_ID
SA9 Mary Howe Assistant F 19-Feb-70 9000 B007
SG14 David Ford Supervisor M 24-Mar-58 18000 B003
SG37 Ann Beech Assistant F 10-Nov-60 12000 B003
SG5 Susan Brand Manager F 3-Jun-40 24000 B003
SL21 John White Manager M 1-Oct-45 30000 B005
SL41 Julie Lee Assistant F 13-Jun-65 9000 B005
Field
RecordHeader
![Page 10: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/10.jpg)
10
2. Relational rules for relational database
Rule 1: First Normal Form Rule Rule 2: Access Row by Content Only
Rule Rule 3: The Unique Row Rule Rule 4: Entity integrity Rule
![Page 11: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/11.jpg)
11
2.1 First Normal Form Rule
Fields cannot have multi-values attributes or have any internal structures.
Staff_ID Name Position Clients
001 Tony Manager Amanda
002 Robbie AgentSmith
Andrew
![Page 12: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/12.jpg)
12
2.1 First Normal Form Rule (cont)
Staff_ID Name Position Clients1
001 Tony Manager Amanda
002
Robbie
Agent
Smith
Clients2
Andrew
Problems:1. Waste space2. Not flexible
![Page 13: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/13.jpg)
13
2.1 First Normal Form Rule (cont)
Staff_ID Name Position Staff_ID
001 Tony Manager
002
Robbie
Agent
Smith
Client
Andrew
Amanda001
002002
Employees Clients
![Page 14: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/14.jpg)
14
2.2 Access Row by Content Only Rule
Records can only be retrieved by their content (the attribute values in each record).
Implications:1. There is no order on the records (e.g., We cannot ask for the 3rd record in the employee table)
2. We cannot retrieve a “pointer” to a record to retrieve it later.
![Page 15: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/15.jpg)
15
2.3 The Unique Row Rule
Two records in a table cannot be identical in all column values at once.
Staff_ID Name Position
001 Tony Manager
002
Robbie
Agent
001 Tony Manager
Note: Keep this row in your mind. You might spend a lot of time and effort to enforce this rule.
![Page 16: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/16.jpg)
16
2.3 The Unique Row Rule (cont)
Table Key: a set of attributes K with two properties:
1. K is unique for each record.2. The subset of K is not unique for each
record.Primary Key: is a table key chosen by
the database designer to uniquely identify specific records in the table.
Note: one table has more than one key, but only one primary key.
![Page 17: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/17.jpg)
17
2.3 The Unique Row Rule (cont)
Staff_ID Name Position
001 Tony Manager
003
Robbie
Agent
002 Scott Agent
Employee
![Page 18: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/18.jpg)
18
2.4 Entity integrity Rule
The primary key cannot be empty
Staff_ID Name Position
001 Tony Manager
003
Robbie
Agent
null Scott Agent
null Scott Agent
Note: 1. Cannot retrieve the record by primary key.2. Cannot distinguish duplicated records.
![Page 19: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/19.jpg)
19
3. Sample database
Client
Private Owner
Properties For Rent
Registration
Staff
Viewing
Branch
![Page 20: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/20.jpg)
20
3. Sample database (cont)
Client table PrivateOwner table Staff table Branch table PropertyForRent table Registration table Viewing table
![Page 21: 1 CS U430: Database Design Spring 2006 Panfeng (Tony) Zhou](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56649e885503460f94b8c6b4/html5/thumbnails/21.jpg)
21
3. Sample database (cont)
Load table structure Load data in table one by one1. Client table2. PrivateOwner table3. Branch table4. Staff table5. PropertyForRent table6. Registration table7. Viewing table