* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Week05-BUAD283-XlmA
Survey
Document related concepts
Microsoft Access wikipedia , lookup
Oracle Database wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Concurrency control wikipedia , lookup
Functional Database Model wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational algebra wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Ingres (database) wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Clusterpoint wikipedia , lookup
ContactPoint wikipedia , lookup
Transcript
Management Information Systems for the Information Age Extended Learning Module A: Designing Databases and Entity-Relationship Diagramming Relational Database Theory & Practice Database Terminology 1/4 What Is a Database? A collection of related information, such as a company’s accounting data A database is comprised of one or more tables Textbook Table ISBN Title Author Publisher Price Course ID Course Table Course ID Title Credits Lecture Hours Lab Hours XLM A: Designing Relational Databases Slide 2 Database Terminology 2/4 What Is a Table? Primary object for collecting and storing data Tables are comprised of records, which are organized into rows similar to an electronic spreadsheet Textbook Table ISBN Title Author Publisher Price XLM A: Designing Relational Databases Course ID Slide 3 Database Terminology 3/4 What Is a Record? An individual and complete entry in a table (for example, a person’s name, address, and phone) Records are comprised of fields, which are the columns of information in a table Each record is uniquely identified by a primary key field (for example, an ID number or ISBN) Textbook Table ISBN Title Author Publisher Price 0-6190-04430-6MS Access 2000 Adamski, Finnegan, CourseHommel Technology XLM A: Designing Relational Databases Course ID 75 BuAd 237 Slide 4 Database Terminology 4/4 What Is a Field? Column of information that holds a single and identifiable piece of data for a record, such as ID, Surname, Given, Address, City, Province… When the primary key field from another table is included, it is referred to as a foreign key field Primary Key Foreign Key Textbook Table ISBN Title Author Publisher Price 0-6190-04430-6MS Access 2000 Adamski, Finnegan, CourseHommel Technology XLM A: Designing Relational Databases Course ID 75 BuAd 237 Slide 5 Databases and Relationships 1/2 Tables are related through a common field that appears in both tables Textbook Table ISBN Title Author Publisher Price Course ID Course Table Course ID Title Credits Lecture Hours Lab Hours XLM A: Designing Relational Databases Slide 6 Databases and Relationships 2/2 Related tables avoid data redundancy and make tables easier to maintain Textbook Table ISBN Title Author Publisher Price 0-6190-04430-6MS Access 2000 Adamski, Finnegan, CourseHommel Technology Course Table Course ID Title BuAd 237 Course ID 75 BuAd 237 Credits Lecture Hours Lab Hours Computer Softw are III 3 2 XLM A: Designing Relational Databases 2 Slide 7 Designing a Database 1/3 Normalization Each data item should be stored in a single location You normalize data by dividing fields into logical groupings of related tables Relational design should attempt to minimize the incidence of empty data fields in a table XLM A: Designing Relational Databases Slide 8 Designing a Database 2/3 Strive for the following design characteristics: Each table represents an identifiable subject or topic Each record stores data for one subject or topic only Each field stores a single piece of data for a record Assign a primary key field that uniquely identifies a record Relate tables based on common fields and values XLM A: Designing Relational Databases Slide 9 Designing a Database 3/3 XLM A: Designing Relational Databases Slide 10 Types of Relationships 1/3 One-to-One Relationship A single record in table A relates to a single record in table B, and vice versa Used when you want to separate data from a main table, perhaps for security reasons Notice that the primary key fields are identical XLM A: Designing Relational Databases Slide 11 Types of Relationships 2/3 One-to-Many Relationship A single record in table A can be related to one or more records in table B, but a single record in table B is related to only one record in table A Often referred to as a parent-child relationship XLM A: Designing Relational Databases Slide 12 Types of Relationships 3/3 Many-to-Many Relationship A single record in table A can be related to one or more records in table B, and a single record in table B can be related to one or more records in table A A third linking table, also called a join or junction table, is used to negotiate the connection by storing primary keys from both tables for a composite or compound key XLM A: Designing Relational Databases Slide 13 XLM A: Textbook Definitions Database A collection of information that you organize and access according to the logical structure of that information. Relational database Uses a series of logically related twodimensional tables or files to store information in the form of a database. XLM A: Designing Relational Databases Slide 14 XLM A: Steps in Designing a Database 1. Defining entity classes and primary keys 2. Defining relationships among entity classes 3. Defining information (fields) for each relation (table) 4. Using a data definition language to create your database XLM A: Designing Relational Databases Slide 15 Step 1: Entity Classes and Primary Keys Entity Class = a table; a concept or subject Primary Key = a field that contains information that uniquely identifies a record Instance = a record; an occurrence of an entity class that can be uniquely described Identify business rules and define integrity constraints Start at the reports (output) and work backwards (input) XLM A: Designing Relational Databases Slide 16 Step 2: Relationships Review business rules in order to verbally describe the relationship between tables Once the relationship has been established, you must then determine the numerical nature of the relationship, referred to as minimum and maximum cardinalities Normalize the database to ensure that the relational structure can be implemented as a series of two-dimensional relations (tables) XLM A: Designing Relational Databases Slide 17 Step 2: Rules of Normalization 1. Eliminate repeating groups or many-tomany relationships using an intersection relation (join or junction tables) 2. Ensure that each field in a relation depends only on the primary key for that relation 3. Remove all derived fields from the relations XLM A: Designing Relational Databases Slide 18 Step 2: E-R Diagramming Creating an intersection relation to solve for a many-to-many relationship using E-R Diagramming XLM A: Designing Relational Databases Slide 19 Step 3: Fields Data Dictionary: Ensure that the information is in the correct relation/table The information should not be able to be derived from other data (unless performance is an issue) XLM A: Designing Relational Databases Slide 20 Step 4: Data Definition Language Data Definition Language Data definition language is part of the database management system (DBMS) Database Management System (DBMS) DBMS helps you specify the logical organization for a database and maintain the information within the database XLM A: Designing Relational Databases Slide 21 Concluding Focus Review the Student Learning Outcomes summary in Chapter 3 and XLM A for textbook-specific terminology Know how to reproduce the E-R diagrams in the text for simple database applications Study this chapter (XLM A) thoroughly, as it serves as a basis for the upcoming projects XLM A: Designing Relational Databases Slide 22