example of a database design paradigm: Suppose a construction company wants to design a database. The company's business rules are summarized as follows:
The Company undertakes a number of projects, each project has: Project number, project name, construction personnel;
The company has a number of employees, each employee has: Employee number, name, gender, position (engineer, technician) and so on;
The company pays wages according to working hours and hourly rates, and the hourly rate is determined by the position of the employee (for example, the technician's hourly rate differs from the engineer).
The company regularly formulates a payroll statement, as shown in 1.
650) this.width=650; "title=" clip_image002 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/5A/1D/ Wkiom1t2qljdlyw6aabgtdhhsb8015.jpg "" 244 "height=" 134 "/>
Obviously the table above is not a table in a database, but a written form. It is now designed as a table in the middle of the database. If there is one such table in the database.
650) this.width=650; "title=" clip_image004 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; margin:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M00/5A/1D/ Wkiom1t2qlmhldgqaabidcpbpni975.jpg "" 244 "height=" 123 "/>
However, the table also has the following problems:
The table contains a large amount of redundancy, which can cause data exceptions:
A. Updating exceptions For example, if you modify the position of the employee number =1001, you must modify the line of all employee number =1001.
B. Adding an exception to add a new employee, you must first assign a project to the employee. Or to add a new employee's data, first assign the employee a virtual project. (because the primary key cannot be empty)
C. Deleting exceptions For example, if a worker is 1001th to resign, it must delete all the data rows of the employee number =1001. Such a deletion would most likely have lost other useful data.
The above table can now be redesigned:
A function dependency graph represents a function dependency between all attributes, as shown in 3.
1. The arrows above the graph indicate that key properties determine non-critical properties.
2. The arrows below the graph represent the function dependencies between the attributes.
650) this.width=650; "title=" clip_image006 "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M02/5A/19/wKioL1T2q2_ Btausaaam64f-m6y286.jpg "" 244 "height="/>
Staff Information table:
|
Employee number |
Name |
Duties |
|
1001 |
Qi Guang |
Q01 |
|
1002 |
Li Si qi |
Q02 |
|
1003 |
Ming Mingliang |
Q03 |
|
1004 |
Ge Yuhong |
Q04 |
Dominate table
|
Job number |
Name of job title |
Hourly wage Rate |
|
Q01 |
Engineer |
65 |
|
Q02 |
Technician |
60 |
|
Q03 |
Workers |
55 |
Project list:
|
Project No. |
Project name |
|
A1 |
Garden Building |
|
A2 |
Overpass |
|
A3 |
Riverside Hotel |
Employee Participation Project List
|
Number |
Project No. |
Employee number |
Hours |
|
1 |
A1 |
1001 |
13 |
|
2 |
A1 |
1002 |
16 |
|
3 |
A1 |
1004 |
19 |
|
4 |
A2 |
1001 |
15 |
|
5 |
A2 |
1003 |
17 |
|
6 |
A3 |
1002 |
18 |
|
7 |
A3 |
1004 |
14 |
Other than that
The physical design of the database is to optimize the operating system, disk layout optimization and configuration, database initialization parameter selection, set up and manage memory, set up and manage the CPU, set up and manage the tablespace, set up and manage rollback segments, set up and manage online redo logs, set up and manage archive redo logs, Set up and manage control files and so on several aspects to consider.
Database Design Examples