Software Development Unit 2 Databases What is a database? • A collection of data organised in a manner that allows access, retrieval and use of that data. • Data is a collection of unprocessed items, which can include text, numbers, images, audio and video. • Information is processed data; it is organised, meaningful and useful. Information can be in the form of audio, images and video. • Computers process data in a database into information. • Database software – Database Management System (DBMS) - users create a computerised database that allows them to • add, modify and delete data in a database; • sort and retrieve data from the database; and • create forms and reports from the data in the database. • Databases allow instant access to data and information. • Most organisations realise that data is one of their more valuable assets, because data is used to generate information. • To make sure that data is accessible, organisations must manage and protect its data. It is vital that the data stored in database software has integrity and is kept secure. • Data Integrity • For a computer to produce correct information, the data that is entered into a database must have integrity – data integrity identifies the quality of the data. • Data integrity is important because computers and people use information to make decisions and take actions. • Qualities of Valuable Information: • For information to have value, it should be: Accurate – error free Verifiable – can be proven as correct or incorrect Timely – has an age limit suited to its use Organised – arranged to suit the needs and requirements of the decision maker • Accessible – available when the decision maker needs it • Useful – has meaning to the person who receives it • Cost-effective – should give more value than it costs to produce. • • • • The 3 main functions of a database are: 1. Data definition 2. Data manipulation 3. Data control 1. Data Definition An electronic database allows you to define the data including its: • • • • Data Type Format Storage requirements Maintenance of Data Integrity 2. Data Manipulation Allows you to: • • • • • Manipulate data efficiently Record and retrieve data easily Search and sort data for particular purposes Produce effective and timely reports Update or add new data at any time 3. Data Control Allows you to • Control user access to the data • Query the database for specific information • Sort and search faster and more accurately Database Management System A DBMS is the program that creates the database and can manipulate the data within it. • They have no data in them. • Are used to create the structure that will contain the data. • Allows users to create a database to suit their particular purposes. Parts Of A Database • Databases are made up of RECORDS. • A record is the information about one particular person or thing. A record is a group of related fields. • Each record has a similar structure but contains different data. • Every record is made up of a number of FIELDS. • A field is a ‘container’ for a particular item of data. • The same field on different records contains the same kind of data. • Data is entered into each field of a record. Example: • Coordinators at PEGS use a database that contains information about every student -DeltaLink. • All the information about any one student is a record. • Within each record there would be separate fields for the student’s first name, surname, address, phone number, photograph, etc. A database defines each field by a number of characteristics such as field size and data type. • Field size defines the maximum number of characters a field can contain. Eg the Surname field contains 15 characters and so has a field size of 15. • Data type specifies the kind of data a field can contain and how the field is used. • Common data types are: Text – letters, numbers or special characters. Numeric – numbers only. AutoNumber – automatically assigned unique number. Currency – dollar and cent amounts. Date – month, day, year. Memo – long text entries. Yes/No (Boolean) – only Yes or No (True/False). Hyperlink – e-mail address or Web address that links to a Web page on the Internet or a Document on a network • Object – photo, audio, video or other documents. • • • • • • • • Relational Databases • Early database programs were called ‘flat-file’ databases because all data was stored in one central table. • These days most commercial database packages store and handle data using a Relational Database Management System (RDBMS). • A relational database is a database that stores data in tables that consist of rows and columns. Each row has a primary key and each column (field) has a unique name. • A relational database stores data as well as data relationships. A relationship is a link within the data. Relationships are set up between tables within a relational database. To do this, the tables must have a common column (field). • The common column (field) is often linked by a unique ID number that is assigned to each record. • Relational databases allow for the efficient sharing of information between different users. • Tables in a relational database can be linked in a variety of ways (relationships): one-to-one 1. A relationship means that for each record in the first table, there is exactly one record in the second table. Example: • Each patient has one medical record and each particular medical record relates to only one person. 2. The most common relationship is a many one-to- relationship. • This means that only one record in the first table can be related to many other records in the second table BUT any record in the second table only relates to one record in the first table. Example • One student can take out many books from the library but any one book can only be taken out by one student at a time. many-to-many 3. A relationship means that for each record in the first table, many records are required in the second table AND for each record in the second table, many records are required in the first table. • Example • Each student will study many subjects and each subject will be studied by many students. INFO TECH MATHS SCIENCE Database Features Storing • Large amounts of data can be stored for later use or modification. It is generally stored on hard disk and backed up to prevent loss Validation • All database management systems allow for electronic validation. • It involves checking, electronically or non-electronically, the integrity of data to ensure that the input data is accurate, relevant and complete. Sorting • Data may be sorted alphabetically, numerically, chronologically, or in descending or ascending order. • A number of different fields can be sorted simultaneously in priority order. Searching • Allows records to be found according to certain criteria • Search criteria are established which use a field, a comparison operator eg >, <, =, etc and comparative data. Reporting • By the process of searching, sorting and calculating, data is manipulated into meaningful information. This information must be communicated usually in the form of a hard copy report. • Reports include a title, a date and meaningful column headings. Data Entry Screens • Also called forms, act as the interface between the user and the database and allow data to be entered, edited and displayed. • Are linked to the individual primary table and new records are therefore added to the existing data. Data Privacy & Security • Privacy is a major concern for those involved with databases and their use. • Large organisations use databases to store confidential information about their clients. • Data is not indestructible. • Data can be (by human error, equipment failure problems with the software or by a catastrophe eg fire or flood): • lost • corrupted and • damaged or destroyed • It can also be • stolen or • illegally copied. • For these reasons data security measures are essential. These measures include: 1. Backing up the data on a regular basis – making a copy of the entire database. - Data can be backed up daily, weekly, monthly or continuously. 2. Attempting to eliminate factors that cause accidental losses. 3. Preventing unauthorised access to data which can result in it being stolen, misused or corrupted eg • By using passwords to restrict access. • By allowing different access privileges for data for different users. This involves establishing who can enter data, modify existing data, delete unwanted data, and view data.