Professional Documents
Culture Documents
14.3 Database Management Concepts
14.3 Database Management Concepts
Objectives
Explain the purpose of a database management system (DBMS). Explain the role of the database administrator. Explain what is meant by data consistency, data integrity, data redundancy and data independence. Describe what is meant by entity relationships and data normalisation.
Data Management
Almost all organisations hold data and it is kept using database software. Data is structured in a way that makes it easy to find the answers to searches. Databases may be flat file or relational. Some specialist software will run the organisations system around the main database.
Relational DBMS
Allows:
A database to be defined, Users may query (search) the database, Data may be added, amended or deleted, The table structure may be changed upgraded, Data may be imported and exported to other applications, A security system to allow only authorised access.
Relational Database
Database
Accounts DBMS
Purchasing Marketing
Personnel
Distribution
Data Approach
Sales Order-Processing
Sales Program
Sales Data
Distribution
Distribution Program
Distribution Data
Data Dictionary
The data dictionary should include:
The names of all tables and fields included in the database, The type of each piece of data including length, Validations and restrictions on data, Explanations of data fields that have complicated names, Relationships between tables and key fields, The programs that access the data and the programs that can amend the data.
Data Consistency
The same data may be found in different files, this could be a problem during updating as all the files need to be updated. If the data only appears in one file and other files are linked to that file then the updating need only be done once.
Data Integrity
Data in the database has to be correct, if it is found not to be so then the system may not be useful. Some errors are:
Transcription, typing errors, careful checking is needed in entering and copying data details, Verification; a second check on data entry, Validation; by data type checks, range checks, Regular updating of new and amended data, Correct operating procedures; and older file being used to update a newer file etc.
Data Redundancy
The database once created should be available to all interested parties within the organisation. Departments may like their own copies of data held on the database but work done on these files also needs to be repeated on the main file. Data constantly being repeated is redundant data.
Entity Relationship
The linking of two tables together by means of a common field.
Tables and Normalisation:
Show your Entity relationship diagrams, an example of a Vets practice is shown below: Entity: VET OWNER PET DRUGS Identifier: Surname. Identification initials/number. Name and customers identification. Code on label.
Ensure that you use the standard notation for your Entities. PET PetID TigerDJ830 RexBY56 TimmyHF Vet Sammuels Higgins Sammuels OwnerID DJ830 BY56 HF44 Animal Cat Dog Hamster Illness Flu Broken Leg Unknown
The standard notation for the table Pet is: PET (PetID, Vet, OwnerID, Animal, Illness) PET is the entity name. PetID is the primary key or unique identifier. Vet, OwnerID, Animal, Illness are the attributes. Vet, OwnerID and Illness are in italics as they are both key fields in another table.
Linked Entities
Illness
Pet
Vet
Owner
Un-normalised Form
A first attempt at setting up a database for this data has all the attributes in a single table called STUDENT as follows: STUDENT (StudentID, StudentName, TutorID, TutorName,
BookID1, IssueDate1, LoanType1, BookTitle1, BookCategory1, BookID2, IssueDate2, LoanType2, BookTitle2, BookCategory2, BookID3, IssueDate3, LoanType3, BookTitle3, BookCategory3, BookID4, IssueDate4, LoanType4, BookTitle4, BookCategory4)
The table will allow for up to four loans to be made by each student.
Loan Table
LOAN
(BookID,IssueDate,LoanType,BookTitle,BookCategory)
The original table leaves:
STUDENT
(StudentID,StudentName,TutorID,TutorName) The problem we have is that the LOAN data does not record which student made each loan, so the LOAN table is revised to show:
LOAN
(StudentID,BookID,IssueDate,LoanType,BookTitle,Book Category)
Relationship 1 One STUDENT will take out many LOANs. Primary key StudentID (in the STUDENT table) links to a foreign key of StudentID (in the LOAN table).
The conclusion is that the LOAN table is not in second normal form, since there are three non-key attributes which could be determined by knowing only the BookID attribute value in the primary key.
Book Table
The solution is to create from the LOAN table, a new table BOOK. STUDENT (StudentID,StudentName,TutorID,TutorName )
LOAN (StudentID,BookID,IssueDate )
BOOK ( BookID, BookTitle, BookCategory ) Relationship 2 There must be a new relationship between the LOAN and BOOK tables.
Tutor Table
But, there is a dependency between them since if we know the StudentName attribute, we shall automatically know the value for the TutorID attribute. The answer again is to create a new table: STUDENT (StudentID, StudentName, TutorID) LOAN (StudentID, BookID, IssueDate) BOOK (BookID, BookTitle, LoanType) TUTOR (TutorID, StudentID)
Entity Diagram
STUDENT BOOK
LOAN
TUTOR
Pages: Doyle: Heathcote: Activities: 261 - 269. 300 - 313. 262, 263, 266.