* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Design a Relational Database
Survey
Document related concepts
Microsoft SQL Server wikipedia , lookup
Relational algebra wikipedia , lookup
Serializability wikipedia , lookup
Microsoft Access wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Oracle Database wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Functional Database Model wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Concurrency control wikipedia , lookup
Ingres (database) wikipedia , lookup
Versant Object Database wikipedia , lookup
Clusterpoint wikipedia , lookup
Relational model wikipedia , lookup
Transcript
Database Design Concepts Design a Relational Database Normalization Rules Creating a properly designed database is timeconsuming but essential to ensuring accurate information and opportunity for growth. It is important to invest time into planning a database before creating any objects. Normalization rules ensure proper database design by reducing redundancy and increasing organization. A database must conform to all three normalization rules. First Normal Form: a database is in first normal form when every field contains a single attribute value. o For example, a credit course scheduling database should not have a field for each section. Sec3 CrsCd Crs# Sec1 Sec2 Database Objects Microsoft Access provides four main objects that can be used to create a relational database: Table: a list of rows and columns, similar to a spreadsheet, that stores data. Tables may store information about grades, students, products, etc. o Record: a table row containing a meaningful and consistent way of combining information o Field: a table column containing a single item of information. Query: answers a question about a table’s data, such as “Which students have a GPA of 3.5 or higher?” Forms: provides an easy way to create, modify, and navigate table records. Reports: creates an attractive, easy-to-read format to view table records or query results. Database Design Process SOC 11023 11056 11045 Table 1: An example database table violating the first normal form. o A course ID is used rather than repeating the course code and course number. This CrsID field relates to the CrsID field in a “Courses” table. Sec# CrsID 1 11023 1 11056 1 11045 Table 2: An example database table in first normal form. Use the following steps to plan a well-designed database (before ever opening your database software program). 1. Determine the purpose of the database, including a list of potential queries/reports that will be required. 2. Create a list of fields that will be needed in order to create the queries/reports mentioned in step one. Always break fields down into their smallest form (e.g. a name should be displayed as two separate fields – first name and last name). 3. Organize the fields into separate tables, grouped by subject. This is the most crucial and time intensive step in the process. 4. Determine a field within each table that uniquely identifies the record. This field will be the primary key (e.g. PSU ID number, SS Number, etc.) 5. Determine the relationships between the separate tables based on common fields (e.g. a PSU ID number is one table can be joined with a PSU ID number in another table). 6. Normalize the tables. 100 Second Normal Form: a database is in second normal form when it is in first normal form and all non-key fields are dependent on the primary key. o For example, an instructor table with a primary key of InstrID should not have a field containing a course description. No functional dependency exists between a course description and an instructor ID number. Third Normal Form: a database is in third normal form when it is in first and second normal forms and no function dependencies exist between non-key fields. o For example, the Dept and DeptChair fields below are dependent upon each other and not the student-related primary key field. The department information should be stored in a department related tables. PSUID FName LName Dept DeptChr 9-10000001 Tom Smith SOC Joe Jones Table 3: An example database table violating the third normal form. This publication is available in alternative media upon request. Penn State is an equal opportunity, affirmative action employer, and is committed to providing employment opportunities to minorities, women, veterans, individuals with disabilities, and other protected groups. Nondiscrimination: http://guru.psu.edu/policies/AD85.html V. 02/27/2014