11
Database design Scenario Developmental stages of the relational database Understanding the problem Planning Designing Implementing Testing, evaluating & maintaining Issues related to the use of the database model Scenario Currently a school uses a non-computerised database system to store the following information about its students: roll class, surname, first name, guardian's name, address, student's date of birth, gender, sport house, emergency-contact telephone number, mailing name, list of subjects offered, and subjects in which the student is enrolled. The system takes up a large amount of space, has many duplicated entries some of these with mistakes and it is time consuming to search. The school intends to introduce a relational-database management system to overcome these problems. Current school data storage and retrieval system (historical perspective; pre- computer database system) School staff, teachers and office staff, are the users of the database. Database used to track all details of students in the school. Large amounts of data are stored. An individual record is required for each student. Lots of duplication exists as details of subjects offered by the school are duplicated on individual student records. Data is organised in alphabetical order on student names within years. Data is stored in a number of filing cabinets. Advantages: quick to find details of a student if year and surname are known data is stored in a central secure location original source material is stored in the student file Disadvantages: slow to find details of students when surname and year are not known data storage takes up a lot of room minimal number of staff can access records at one time data is duplicated Stages of development: The construction of the electronic database system will follow the stages of Developing Information Systems:

Document1

  • Upload
    sandesh

  • View
    213

  • Download
    0

Embed Size (px)

DESCRIPTION

2 ) Module A1 School Records Management

Citation preview

Page 1: Document1

Database design

Scenario Developmental stages of the relational databaseUnderstanding the problemPlanningDesigningImplementingTesting, evaluating & maintainingIssues related to the use of the database model

Scenario

Currently a school uses a non-computerised database system to store the following information about its students: roll class, surname, first name, guardian's name, address, student's date of birth, gender, sport house, emergency-contact telephone number, mailing name, list of subjects offered, and subjects in which the student is enrolled. The system takes up a large amount of space, has many duplicated entries some of these with mistakes and it is time consuming to search. The school intends to introduce a relational-database management system to overcome these problems.

Current school data storage and retrieval system (historical perspective; pre-computer database system)

School staff, teachers and office staff, are the users of the database. Database used to track all details of students in the school. Large amounts of data are stored. An individual record is required for each student. Lots of duplication exists as details of subjects offered by the school are duplicated on individual student records. Data is organised in alphabetical order on student names within years. Data is stored in a number of filing cabinets.

Advantages:

quick to find details of a student if year and surname are known data is stored in a central secure location original source material is stored in the student file

Disadvantages:

slow to find details of students when surname and year are not known data storage takes up a lot of room minimal number of staff can access records at one time data is duplicated

Stages of development:

The construction of the electronic database system will follow the stages of Developing Information Systems:

Understanding the problem Planning Designing Implementing Testing, evaluating and maintaining

Page 2: Document1

Understanding the problem

In this stage the current system is analysed to determine the functions it performs and those that it is unable to perform. Direct and indirect users of the new system are interviewed to determine what they require from the new system. The inputs to the new system, the processes it is to perform and the outputs from the system are clearly defined. A recommendation is made about the type of new system that will be required to meet the identified needs. During the analysis stage, the following is determined:

current storage space of student records needs to decrease an easily update-able backup of student records is required one staff member is to be responsible for the administration of the system unnecessary duplication of data is to be avoided all teaching staff, office staff and the Principal need to have access to the database

simultaneously - read access only is required reports such as roll class lists, subject class lists, lists of sporting houses, student

contact details and family mailing lists need to be easily generated

To meet these requirements, a relational database system has been recommended. A relational database is a database in which data is organised in a series of relationships, or two-dimensional tables, where the columns (attributes) represent data fields, and the rows (tuples) represent records. Linking of data between records in different files is done by means of a key field.

The relational model was chosen in preference to a flat file system as the requirements of users would not be met with a flat file. A flat file is a type of database where all of the data is contained in one file. For all of the information to be held in one table, every student record would require data to be unnecessarily duplicated, introducing redundant data. For example, every student record would require information about the subjects the student is enrolled in and these subject details would be duplicated through out the flat file. This duplicated data increases the space required by the computer system to process and store the data. It also leads to possible problems with the integrity of the data when modifications to this duplicated data is required.

Planning

During this stage a project plan will usually created in order to divide the entire project into smaller parts. A Gantt chart may be used to represent the parts of the project along with expected start and finish dates for identified tasks. Resources for the construction of the electronic database will also need to be identified. Information technology (hardware and software) and personnel (the project team) will generally constitute most of the resources required to develop an information system.

Designing

In this stage the relational database system is developed. The system is made up of two parts, the database management system and the database. A DataBase Management System (DBMS) is the software that builds, maintains and provides access to a database. It also provides data dictionary facilities, file protection and security against unauthorised use. Relational database management systems include software packages such as Lotus Approach and Microsoft Access. These packages provide the frame work to allow the tables to be developed and linked. A databaseis defined as an organised collection of data items which may be accessed by a database management system. The database may consist of several

Page 3: Document1

linked files. The school database will consist of a number of tables that hold information on students and related material.

The information to be stored on students; roll class, surname, first name, guardian's name, address, student's date of birth, gender, sport house, emergency-contact telephone number, mailing name, list of subjects offered, and subjects in which the student is enrolled will be held in the following tables:

roll class sports house students subjects enrolled subjects offered contact details.

Figure 1 shows a schematic diagram (or schema) for this database using the tables outlined above. A schematic diagram can be defined as an organised plan of the entire database showing how and where the data is to be found, descriptions of the data, and their logical relationships. The schematic diagram is produced by the database designer and is maintained by the database administrator. It shows a list of the attributes (field headings) for each table.

Figure 1. Schematic diagram for school relational database model.

Figure 1 indicates the primary key field (PK) for each table where it exists. The primary key is a character or group of characters used to identify a unique record in a database. The key is composed of one or more fields from the record. Also known as primary key. Examples of primary keys could be ID number, part number, payroll number, etc. The primary key field is never more than one field within a table in the school model. All tables have a primary key with the exception of the 'Students Enrolled' table. This is because neither field in this table will have unique entries (however tuples / records within this table will be unique). This table is used to link the 'Students' table with the 'Subjects Offered' table.

The relationships between the tables are indicated by the lines between them in Figure 1. A table is linked by its primary key to a field holding the same information in another table. The lines in Figure 1 indicate the fields used to link the tables. Thus the information held in the 'Roll class Code' field in the 'Roll Class' table is the same as in the 'Roll Code' field of the 'Students' table. In the 'Roll Class' table, every entry in this field is unique, allowing it to be used as a primary key. In the 'Students Table' this field is used to show the roll class a particular student belongs to. It is therefore not unique in the 'Students Table'.

A better understanding of the table, the fields within the table and the information held in the fields can be obtained from the data dictionary for the table. A data dictionary is defined as a comprehensive description of each field in the database. This commonly includes: field name, data type, data format, field size, description and example.

Figure 2 shows the data dictionary for the 'Roll Class' table. The table contains three fields, a code for the roll class, a description of the roll class, and the year the roll class is based on

Page 4: Document1

(the school is using rolls based on years, not vertical rolls where the roll would be based on a number of years). The 'Roll Class' table will contain a tuple / record for every roll class in the school. By linking the 'Roll Class' table to the 'Students' table, the roll class and year a student is in can be discovered.

Field Name

Data Types

Data Format

Field Size

Description Example

Roll Class Code

Text   10Unique code for roll class

YO7A

Roll Class Title

Text   20Description of the roll class

Year 07 Roll A

Roll Class Year

Number   8Year the roll class is made from

7

Figure 2. Data dictionary for the Roll Class table

Figure 3 shows the data dictionary for the 'Sports House' table. The table contains three fields, a single letter code for each house (the first letter of the house's colour), the house colour and the name of the house. The 'Sports House' table will contain a tuple / record for every sports house in the school. A single letter primary key code was chosen to reduce the amount of data entry required for the same field in the 'Students' table.

Field Name

Data Types

Data format

Field Size

Description Example

House Code

Text   1Unique house code

B

House Colour

Text   6 House colour Blue

House Name

Text   15

Name given to the sporting house

L7

Figure 3. Data dictionary for the Sports House table

The 'Students' table is the central table for the database model. It contains information that is unique to students. Figure 4 shows the data dictionary for this table. Details that are not specific to a particular student are placed in other tables to reduce data redundancy. Student contact details for example are placed in the 'Contact Details' table as these would be repeated for all of the children within the same family at the school if they were in the 'Students Table'. The fields 'First Name', 'Last Name', 'Gender' and 'DOB' hold student information. The fields 'Contact ID', Roll Call', 'House Code' and 'Student ID' link this table to the other tables within the database. The 'Student ID' field has a unique entry for every record / tuple in the table and is the primary key field for the table. The 'Students' table will contain a tuple / record for every student enrolled at the school.

Data validation has been used for the 'Gender' field in the 'Students' table. Data validation is defined as a check on entered data to ensure that it is of the correct data type and that its value is sensible. If anything other then 'M' or 'F' is entered into the 'Gender' field,

Page 5: Document1

the entry will not be allowed and a warning message will be displayed. This will assist accurate data entry.

Field Name

Data Types

Data Format

Field Size

Description Example

Student ID

Text NNNNNN 6Unique Student ID

950001

First Name

Text   50Student's first name

Mary

Last Name

Text   50Student's last name

Jones

Gender Text   1Male or Female

F

DOB Date/Time DD/MM/YY 8 Date of birth 02/03/1992

Contact ID

Text   7 Contact code C950001

Roll Code Text   10Roll class code

YO7A

House Code

Text   1Sports house code

B

Figure 4. Data dictionary for the Students table

Figure 5 shows the data dictionary for the 'Subjects Enrolled' table. This table is used to link the 'Students' table with the 'Subjects Offered' table. This table does not have a primary key since neither field will contain unique information. The 'Subjects Enrolled' table will have a unique record / tuple for every subject studied by every student in the school, making it the table with the most entries in the model.

Field Name

Data Types

Data Format

Field Size

Description Example

Student ID Text NNNNNN6 Student ID

number950001

Subject Code

Text  10

Subject Code 7m1

Figure 5. Data dictionary for the Subjects Enrolled table

Figure 6 shows the data dictionary for the 'Subjects Offered' table. This table holds the subject code and the subject title for all of the subjects offered at the school. There will be a unique record / tuple for every subject offered at the school. The 'Subject Code' field is the primary key field for this table.

Field Name

Data Types

Data Format

Field Size

Description Example

Subject Code

Text   10Subject Code

7m1

Page 6: Document1

Subject Name

Text   50Subject Title

Year 7 Maths 1

Figure 6. Data dictionary for the Subjects Offered table

Figure 7 shows the data dictionary for the 'Contact Details' table. The information in this table has been separated from the 'Students' table since more than one student may have the same contact details. The unique contact ID field links this table to the 'Students' table and is the primary key field for this table. There will be a unique record for every unique contact person.

Field Name

Data Types

Data FormatField Size

Description Example

Contact ID

Text

 

7 Unique Student contact details ID

C950001

Guardian's Name

Text 

50 Full name of Guardian

Sue Jones

Mailing Name

Text 

50 Guardian's mailing name

Mrs S Jones

AddressText

 100 Mailing

address12 Music Crt

Phone

Number

#########

9 Emergency-contact telephone number

98883456

Figure 7. Data dictionary for the Contact Details table

Figure 8 shows samples of all of the tables used in the model with data in them. Note the common data in the fields that link the tables. When designing the database, consideration needs to be given to the primary key format within tables. The system used should allow records in the table to be sorted in particular orders, and allow records to be added and deleted.

Page 7: Document1

Figure 8. Sample of data in Schools relational database model.

Implementing

In this stage, the relational database is created using the chosen relational database management system. Data will be gathered, checked and entered into the DBMS. Frequently required selections as well as reports will be established using the DBMS. The system will be checked using test data to see if expected searches can be performed and reports produced.

One important function of the DBMS chosen to implement the database, is providing access to the data. During the implementation phase, the DBMS will be used to establish procedures to access data through:

searching sorting reporting

During the analysis stage, the users of the school database specified searches they would like to perform on the database. A search specification is created using the relational DBMS' query language. Query language is defined as the method of formulating queries in an information retrieval system to retrieve data. A query language builds search specifications using relational and logical operators. Relational and logical operators compare expressions that make up the search specification. Figure 11 shows a sample of relational and logical operators.

Operator Type Description

> Relational Greater Than

=> Relational Greater Than or Equal

< Relational Less Than

<= Relational Less Than or Equal

Page 8: Document1

= Relational Equal

<> Relational Not Equal

AND Logical Both expressions must be true

OR Logical At least one expression must be true

NOT Logical All expressions must be false

Figure 11. Relational and Logical Operators

A query in Microsoft Access to produce a list of all students in the "Red" sports house, displayed in ascending order according to last name, would take the form:

SELECT [First Name], [Last Name]

FROM Students

WHERE [House Code] = "R"

ORDER BY [Last Name], [First Name], ASC

The SELECT keyword in the query specifies the fields to be selected. The FROM keyword specifies the table the fields are to come from. The WHERE part of the query holds the condition and in this case a relational operator is used on the field "House Code" from the "Students" table. Square brackets are used when field or table names include spaces or punctuation. The following query would produce a mailing list of all families for the school;

The ORDERED BY command in this search will sort the data on the 'Last Name' field followed by the 'First Name' field. The ASC will put records into ascending order.

Reports are produced from linking data together in one or more tables. The resulting report can be printed and past onto others. In the design phase, templates for requested reports will be created so that these reports can be easily obtained in the future.

Testing, evaluating and maintaining

It is in this stage that the new school database system will be fully operational with changes being made to the data as a result of natural events such as a student entering or leaving the school.

Tests are carried out for expected and unexpected data, and plans are made in case of a partial or total system failure. The electronic database is evaluated while it is operational and a report may be written which is based on the feedback from the staff at the school who use/manage the system.

In the understanding the problem stage it was decided to have one person responsible for the database. This person will become the Database Administrator. The Database Administrator is responsible for setting up and maintaining the integrity and security of a database. An administrator also helps programmers and end-users to utilise the database properly.

The Database Administrator has responsibility for the roles of:

Page 9: Document1

privacy security data integrity data validation data bias hardware management software management.

Privacy, security, hardware management and software management are obvious roles. Data integrity is defined as a term used when describing the reliability of the data. It incorporates a statement of data accuracy (correctness), correct entry of the data and timeliness (currency) of the data. In other words, this role involves making sure the original data is accurate, that the data is correctly entered, and that the data remains current.

Data validation is a check on entered data to ensure that it is of the correct data type and that its value is sensible. In the design stage, the DBMS was used to build in automatic data validation on data entry. The Database Administrator will have the responsibility for any additional data validation.

Data bias is bias which a user of information may apply based on the data stored in a database........eg data about an individual stored in a telephone directory is biased since only those people with a listed telephone number are included. The database administrator attempts to reduce this.

Issues related to the use of the database model

Consideration needs to be given to who will have access to the database, the uses to which it will be put and the amount of access to be given. If the database model is implemented on a network then it may become widely accessible. If student work stations are on the same network, then the ease of use that has been established for legitimate users may need to be off-set against restricting illegal users of the system.

Some users may need to have their access restricted to only relevant information. The bias that is built in the database model may be destructive if the entire database was accessed by all. For example, if two students from the same family have different contact people, then this may imply something about the students family situation. Inappropriate use of this type of data may cause serious problems for the students involved.