Docsity

Database systematics way of using database, Summaries of Database Management Systems (DBMS)

Toggle sidebar
bg1
1
COPPERBELT UNIVERSITY
COMPUTER SCIENCE DEPARTMENT
INTRODUCTION TO COMPUTING
UNIT 13: DATABASES
INTRODUCTION
Mankind has always relied upon data and information for its survival and growth. Numerous
techniques and devices have been developed to manage and organize the information. Earlier,
people used to store and process data with the help of papers, file folders, microfilms and so on.
About half a century ago, computer was developed. It was a revolutionary technology, and
almost instantly, the computers were employed to resolve the problem of information storage and
retrieval. They have replaced tons of papers, file folders and file cabinets as the principal media
for storing important information. With the advent of small, powerful personal computers,
databases have become more readily usable by the average computer user.
In today's changing technological environment, information is the power. Owing to the rapid
growth of information technology in the last few decades, organizations and institutions have
realized the value of information as a resource and the importance of the speed and ease with
which this resource can be managed. This eternal quest for data management has led to the
development of database technology. The term database refers to a collection of related data
from which the users can efficiently retrieve the desired information. In addition to the storage
and retrieval of data, certain other operations can also be performed on a database. These
operations include adding, updating and deleting data. All these operations on a database are
performed using a database management system (DBMS). Essentially, a DBMS is a
computerized record-keeping system. In this chapter, we will learn about databases, the
terminology used in the world of databases and various other aspects of database technologies.
DATA, INFORMATION AND KNOWLEDGE
Before defining database, we should know about the two terms, data and information, which are
used frequently with databases. Data can be anything such as a number, a person's name, images,
sounds and so on. Hence, data can be defined as a set of isolated and unrelated raw facts
(represented by values), which have little or no meaning because they lack a context for
evaluation. Usually, the values are represented in the forms of characters, numbers or any
symbol such as 'Monica', '35' and 'chef'. Note that although these words and numbers have
certain meaning, it is difficult to figure out exactly what these values signify. However, when the
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Database systematics way of using database and more Summaries Database Management Systems (DBMS) in PDF only on Docsity!

COPPERBELT UNIVERSITY

COMPUTER SCIENCE DEPARTMENT

INTRODUCTION TO COMPUTING

UNIT 13: DATABASES

INTRODUCTION

Mankind has always relied upon data and information for its survival and growth. Numerous techniques and devices have been developed to manage and organize the information. Earlier, people used to store and process data with the help of papers, file folders, microfilms and so on. About half a century ago, computer was developed. It was a revolutionary technology, and almost instantly, the computers were employed to resolve the problem of information storage and retrieval. They have replaced tons of papers, file folders and file cabinets as the principal media for storing important information. With the advent of small, powerful personal computers, databases have become more readily usable by the average computer user.

In today's changing technological environment, information is the power. Owing to the rapid growth of information technology in the last few decades, organizations and institutions have realized the value of information as a resource and the importance of the speed and ease with which this resource can be managed. This eternal quest for data management has led to the development of database technology. The term database refers to a collection of related data from which the users can efficiently retrieve the desired information. In addition to the storage and retrieval of data, certain other operations can also be performed on a database. These operations include adding, updating and deleting data. All these operations on a database are performed using a database management system (DBMS). Essentially, a DBMS is a computerized record-keeping system. In this chapter, we will learn about databases, the terminology used in the world of databases and various other aspects of database technologies.

DATA, INFORMATION AND KNOWLEDGE

Before defining database, we should know about the two terms, data and information, which are used frequently with databases. Data can be anything such as a number, a person's name, images, sounds and so on. Hence, data can be defined as a set of isolated and unrelated raw facts (represented by values), which have little or no meaning because they lack a context for evaluation. Usually, the values are represented in the forms of characters, numbers or any symbol such as 'Monica', '35' and 'chef'. Note that although these words and numbers have certain meaning, it is difficult to figure out exactly what these values signify. However, when the

data are processed and converted into a meaningful and useful form, it is known as information. Hence, information can be defined as a set of organized and validated collection of data. For example, 'Monica is 35 years old and she is a chef'.

Strictly speaking, data refer to the values physically recorded in the database, whereas information refers to the conclusion or meaning drawn out of it. With respect to database, these terms are synonymous. In reality, information in one sense may be data in another. Sometimes, it is hard to make the difference between the two. For example, the bill at the grocery store can be used as data as well as information. As information, the bill represents the amount you owe to the store. However, when the store manager uses his computer to calculate total sales for the day based on all purchases made, it is treated as data. In summary, whether something is data or information depends on how it is used in relation to given context.

Other than data and information, one more term, knowledge, is frequently used with database technology. Knowledge is the act of understanding the context in which the information is used. It can be based on learning through information, experience and/or intuition. Based on the knowledge, the information can be used in a particular context, for example, if an hotelier uses the information about Monica (she is a chef) to hire her, he is using his knowledge. Hence, knowledge can also be referred to as a person's capability and wisdom and how much that person knows about a particular subject. Consequently, it can be said that data constitutes information, and information constitutes knowledge.

Prerequisites of Information

Information is the processed data, on which decisions are taken and the subsequent actions are performed thereafter. For the decisions to be meaningful and useful, the information must possess the following qualities:

 Accurate: To be useful, information must be accurate at all levels because all further developments are based on the available information. Accurate information provides a reliable and valid representation of raw facts. The cost of inaccurate or distorted information can be extremely high.  Timely: Information is appreciated only if it is available on time. If the information is available ahead of time, its value may be diminished because the information might get archaic or the user may simply forget it. Obviously, any availability after the due time simply has no significance.  Complete: Complete information tends to be comprehensive in covering the issue or topic of interest. Without complete information, a decision- maker may get a distorted view of reality. For example, incomplete market information can lead businesses to introduce products and services not desired by the customers. As a result, the organization may incur huge losses.

Information and Productivity: Information helps in making sense of our environment, which assists in achieving the performance objectives. In fact, productivity is directly related to the availability and value of the information and its application in the related context. Individuals and organizations need to ensure that their information-processing systems are properly integrated. They should also ensure that necessary information is being supplied to the right people at the right time in the organization. For example, it makes sense to share customer complaint data about a specific product with the members of the product development team responsible for redesign, thereby increasing the efficiency as well as productivity.

DATABASE: DEFINITION

A database can be defined as a collection of related data in an organized way. The organized information (i.e. database) serves as a base from which the desired information can be retrieved, conclusions can be drawn and decisions can be made, by further reorganizing or processing these data. In essence, a database not only stores information, but the information is integrated so that when the database is interrogated, users can get something useful from it. A database can be anything from a simple collection of roll numbers, names, addresses and phone numbers of the students to a complex collection of sound, images and even video or film clippings. Although databases are generally computerized, instances of non-computerized databases from everyday life can be cited in abundance. A dictionary, a phone book, a collection of recipes and a TV guide are all common examples of non-computerized databases. The examples of computerized databases include customer files, employee rosters, books catalog, equipment inventories and sales transactions.

Fundamentals of Database

Within the database, the data are organized into storage containers, called tables. Tables are made up of columns and rows. In a table, columns represent individual fields and rows represent records of data. The following are the basic database terms.

Field

A field represents one related part of a table and is the smallest logical structure of storage in a database. It holds one piece of information about an item or a subject. For example, in a database maintaining information about employee, the fields can be Code, Deptt, Name, Address, City and Phone (see Figure 1).

Figure 1: Fields and Records in a Tab l e Record

A record is a collection of multiple related fields that can be treated as a unit. For example, fields Code, Deptt, Name, Address, City and Phone for a particular employee form a record. Figure 1 contains nine records (0101–0109) and each record has six fields. In database terminology, each row is a record. However, database experts prefer to use the word row, since record sometimes has other connotations outside the databases.

Table

A table is a named collection of logically related multiple records. For example, a collection of all the employee records of a company form employee table. Note that every record in a table has the same set of fields. Depending on the database software, a table can also be referred to as a file. The collection of multiple related files (tables) forms the database.

NOTE: The database software can save each collection of records (table) in a separate file or saved in a single database, which is logically separated in tables.

Data Type

A data type determines the type of data that can be stored in a column. Although many data types are available, the four most commonly used data types are Character, Numeric, Boolean and DateTime. Character data types are used to store characters, numbers, special characters or combinations of any of these. Note that if a numeric value is stored in an alphanumeric field, the value is treated as a character, not as a number. Numeric data types are used to store only numeric values. Boolean data types store only logical values, either true or false. DateTime data type is used to store date and time values. The values for this data type vary widely depending on the database management software being used.

Data Dictionary

Apart from the data, the database also stores metadata, which describes the tables, columns, indexes, constraints and other items that make up the database. In simple words, metadata is the data about data. This metadata is stored in an area called the data dictionary. Hence, a data dictionary defines the basic organization of a database. It contains the list of all files in the database, the number of records in each file and the names and types of each field. Data dictionaries do not contain any actual data from the database, but only the information for managing it.

Most database systems keep the data dictionary hidden from users to prevent them from accidentally destroying its contents. Different users use the dictionary in different ways. The database administrator (DBA) needs a dictionary to ensure consistency among the data items, to educate users about the database content and to help ensure that different department defines the same data in the same way. The programmers may use it to ensure that they have the name and coding of the data items or segments correct in their programs. Managers may use it as a guide to decide what data could be made available to them.

LOGICAL DATA CONCEPTS

The overall database design and implementation process starts with requirements gathering and specifications. Once the requirements of the user have been specified, the next step is to construct an abstract or conceptual model of a database based on the requirements of the user. The conceptual model represents various pieces of data and their relationships at a very high level of abstraction. It mainly focuses on what data are required and how it should be organized rather than what operations are to be performed on the data. The conceptual model can be represented using Entity-Relationship model (E-R model). The E-R model views the real world as a set of basic objects (known as entities), their characteristics (known as attributes) and associations among these objects (known as relationships). The entities, attributes and relationships are the basic constructs of an E-R model.

Entity

An entity is an object that has an independent existence in the real world. It includes all those 'things' about which the data are collected. An entity may be a tangible object such as a student, a place or a part. It may also be intangible such as an event, a job title or a customer account. Diagrammatically, entities are represented in rectangles.

Attributes

Attributes are the properties of an entity that characterize and describe it. In a database, entities are represented by tables and attributes by columns. For example, a CUSTOMER entity might have numerous attributes such as Code, Name and Address. Similarly, the ITEMS entity may

have attributes like Item_Id and Price. They are drawn in elliptical shapes along with the entity rectangles (see Figure 3).

Figure 3: Attributes

Figure 4: Entities, Attributes and Rela ti onsh i p

Relationship

Relationship is an association, dependency or link between two or more entities and is represented by a diamond symbol. A relationship describes how two or more entities are related to each other. For example, the relationship Buys (shown in Figure 4) associates the CUSTOMER entity with ITEMS entity.

Types of Relationship

Even though a relationship may involve more than two entities, the most commonly encountered relationships are binary, involving exactly two entities. Generally, such binary relationships are of three types—one-to-one, one-to-many and many-to-many.

(such as adding, deleting and updating records) to a sequential file is also a difficult operation. For example, to add a record in the middle of a sequential file, the entire file has to be sorted, rewritten and stored on the storage device again.

Direct Files

Direct files facilitate accessing any record directly or randomly without having to traverse the sequence of records. These files are also known as random or relative files. Even though only one item can be accessed at a time, that item may be stored anywhere in the file. For example, in case of CDs, any song can be played randomly. Generally, these files are stored on direct access storage devices such as hard disks and CDs.

When the records are stored, the program itself generates the address for the record by applying certain techniques to its key field. The relationship between the key field and the corresponding address of the location of the record on the storage device can be given in the form of equation as: F (key value) = Record Address. The same formula is used again to retrieve the desired record.

Direct access method facilitates speedy and direct retrieval of information. Any record can be accessed within a fraction of time because unlike sequential files, this method does not have to traverse a sequence of records. As a result, updating, addition and deletion of record become much faster. However, this method is expensive than sequential, because usually the direct files are stored on direct access devices, which are expensive as compared to sequential storage devices. Moreover, direct access is less storage efficient, because it tends to generate wide gaps in between any two records. In addition, address generation overhead is also involved for accessing records due to addressing functions.

Indexed Sequential Files

Before discussing the indexed sequential file organization, let us first know about indexes. You might have used indexing many times while going through a book. At the back pages of most of the books, certain key words (topics), along with the page numbers on which these topics are discussed, are given. In similar fashion, an indexed file includes an index table (also known as reference table) that relates key field values to storage locations of the corresponding records. Hence, indexing can be defined as a technique of ordering the records in a table without making any modification in the table.

Essentially, indexed sequential technique is a hybrid of sequential and direct file organization. It provides a combination of access types that are supported by a sequential and a direct file. The indexed file organization uses a separate index file, which contains the key values and the location of the corresponding record. The records are organized in an orderly sequence and the index table is used to access the records without searching through the entire file. The records may be in random sequence, but the index table is stored in sorted sequence on the key values.

Since the index table is in sorted sequence, the file management system simply accesses the records in the order of the index values. To access a particular record, a search is made in the index table to determine the address of the first record of the segment in which the data are placed. Then, a direct access is made to that address. After that, a sequential search is invoked until the desired record is located.

Index file requires considerably less space than the data file as it requires only two fields—the key field and the address of records location, even if the record may have numerous fields. However, it is still an overhead, as other file organizations do not use any extra file. Indexes do not affect the file organization of records physically, that is, various indexes can use the same file without rearranging its records. Indexing speeds up the data retrieval, but it may slow down the update process because indexes also need to be maintained along with the data file, while adding and deleting. Since the index sequential files require direct access storage devices, they are an expensive means of file organization.

DATABASE MANAGEMENT SYSTEM

As discussed earlier, a database is a collection of well-organized data. To carry out operations like insertion, deletion and retrieval, the database needs to be managed by a software package. This software is called a database management system (DBMS). Hence, DBMS can be defined as a collection of interrelated data and a set of programs to access that data. The primary goal of a DBMS is to provide an environment that is congenial and efficient to retrieve and store information. It allows a user to store, update and retrieve data in abstract terms. DBMS eases the maintenance and retrieval of information from a database. A DBMS also relieves the user from having to know about the exact physical representations of data and from specifying detailed algorithms for storing, updating and retrieving the data.

Principally, a database system is a computerized record-keeping system whose overall purpose is to maintain information and to make it available on demand. The management of data involves defining the structures for information storage and provision of mechanisms for its manipulation. DBMS also provides mechanisms for the security of the stored information from unauthorized access and recovery of the data during system failures. In addition, the database system avoids possible anomalous results in case the data are to be shared among several users.

Need for Database Management System

Historically, information systems employed stand-alone systems for separate applications each with their own set of files (file based systems). This meant that data such as addresses may be duplicated in many separate systems such as an employee's address may be held once in the payroll system and again in the personnel system. This causes waste of space and inconsistency.

In general, the data in a DBMS are integrated as well as shared.

 Integrated: A database can be considered as a unification of several data files (tables), with any redundancy among those files eliminated (either wholly or partly). For example, a database might contain both the EMPLOYEE and the ALLOWANCE files. To process the ALLOWANCE file, one need not include the redundant field in this database as it can easily be extracted by referring to the EMPLOYEE table.  Shared: Shared data means that individual pieces of data in the database can be shared among numerous users. Each user can have access to the same piece of information and every user can use it for different purpose. In the above example, department information in the EMPLOYEE file can be shared by users in the personnel department and the accounts department.

Benefits of Database Management System

Let us discuss some of the major advantages provided by the DBMS.

 Reduction in Data Redundancy: Data redundancy refers to duplication of data. In non- database systems, each application has its own separate files. This can often lead to redundancy in stored data, which results in wastage of space. For example, in case of file- based system of a magazine publishing house, the customer department keeps a separate customer details file. A similar file is also kept with the postage-handling department. Hence, the same data are duplicated in two separate places. The other problem with this system is that the data may not be updated consistently. Suppose a customer requests for change in his/her posting address to the customer department and the changed address is reflected in his/her record. However, it is not guaranteed that the same change is also done in the postage-handling department's file. If the database system forgets or delays to update this file, this may lead to postage of the subscribed magazine to the old address.

A DBMS does not maintain separate copies of the same data. All the data are kept at one place and various applications refer to the data from this centrally controlled system. As a result, when the customer demands the change in address, it is done at one place from where the concerned department's application uses the data for processing.

 Reduction in Inconsistency: This is a corollary of the previous point. Suppose that the customer's xyz address is represented by two distinct entries in the stored database and the database system is not aware of this duplication (i.e. redundancy is not controlled), then there will be some occasions on which the two entries will not agree, that is, when only one of the two entries has been updated. At such times, the database is said to be inconsistent. As a result, inconsistent or contradictory information will be supplied to the users.

It is obvious that if the given fact is represented by a single entry, then such inconsistencies may not occur. Alternatively, even if the redundancy is not removed but is controlled, then the DBMS ensures that the database is always consistent by ensuring that any change made to either of the two entries is automatically applied to the other one also. This process is known as propagating update. Note that recent DBMS packages like Oracle and Sybase are built with capabilities of propagating updates automatically.

 Sharing of Data: Sharing of data allows the existing applications to use the data in the database simultaneously. It also helps in developing new applications, which will use the same stored data. Due to shared data, it is possible to satisfy the data requirement of new applications without having to create any additional stored data or with marginal modification. For example, in the banking corporation, the account holder's name and address can be shared by all the applications. As a result, any changes in the current account policies can be implemented with virtually no changes in the table's structure.

 Enforcement of Standards: Since access to the database must be through the DBMS, standards are easier to enforce. Standards may relate to the naming of the data, the format of the data, the structure of the data and so on. Standards may include the yardsticks laid by the company or organization using the database. There may be certain industry, national or international standards that must be satisfied by the data. Standardization of data particularly helps in migrating or interchanging data between different systems.

 Improvement in Data Security: In conventional systems, applications were developed in an impromptu manner. Usually, different systems of an organization would access different components of the operational data. In such an environment, enforcing security can be quite difficult. Setting up of a DBMS makes it easier to enforce security restrictions since the data are stored centrally. DBMS can ensure that the only means of accessing the database is through the authorized channel. Hence, data security checks can be carried out whenever access is attempted to sensitive data. To ensure security, DBMS provides security tools such as user codes and passwords. Different checks can be established for each type of access (i.e. addition, modification and deletion) to each piece of information in the database.

 Maintenance of Data Integrity: Data integrity refers to ensuring that the data in the database are accurate. Since, in DBMS, the data are centralized and is used by a number of users at a time, it is essential to enforce integrity controls. Integrity may be compromised in many ways. For example, someone might input the salary data of a full- time employee as 50,000 rather than 5000.

 Hardware: Hardware of the system can range from a PC to a network of computers. It also includes various storage devices (like hard disks) and input and output devices (like monitor and printer).  Software: Software of a DBMS includes the DBMS operating system, network software (if necessary) and the application programs.  Users: In DBMS, generally three broad classes of users are considered. These are application programmers, end users and DBA. The application programmers develop the application programs. These programs can manipulate the database in all possible ways. The end users access the database from a terminal using a query language provided by the database system or through application programs developed by application programmers. The DBA is the person who is responsible for the design, construction and maintenance of a database.

Database Administrator

One of the main reasons for having DBMSs is to have central control of both data and programs accessing that data. The person having the central control over the system is called database administrator (DBA). The DBA is an information technology expert or a well-trained, computer literate who is responsible for the technical operations of a database or all databases in an organization. In reality, the DBA may be a department or group rather than one person. They are the custodian of database accuracy, efficiency, maintenance and development. Largely, they control access to information, ensuring that it is updated accurately and regularly. As part of a database team, they collaborate in the design and development of databases to meet ongoing user needs.

A DBA needs to stay abreast of emerging technologies and new design approaches. Typically, a DBA either has a degree in computer science and some on-the-job training with any database product or more extensive experience with a range of database products. Usually one should be experienced in major database management products such as Structured Query Language (SQL), SAP and Oracle-based database management software. DBAs should have an excellent knowledge of computers and organizational structures.

The DBA has many different responsibilities, but the overall goal of a DBA is to maintain the database system and to provide users with access to the required information when they need it. The DBA makes sure that the database is protected and that any chance of data loss is minimized. Typical responsibilities of the DBA include the following:

Ensuring regular backups of a database, and in case of failure (or disaster like fire or flood), suitable recovery procedures are used to restore the database services with as little down time as possible.

 Granting different types of authorization to regulate which parts of the database various users can access.  Ensuring regular and accurate update of database(s).  Collaborating in the design and development of databases to meet new user needs and respond to anticipate technological innovations.  Communicating regularly with internal technical applications and operational staff to ensure the database integrity and security.  Identifying and resolving user's problems.  Facilitating sharing of common data by overseeing proper key management and data dictionary maintenance.  Procuring and maintaining database software and related documents and tools.

DATABASE LANGUAGES

A DBMS mainly provides two database languages—data definition language (DDL) and data manipulation language (DML) to implement the databases.

Data Definition Language: DDL is used to create and delete database and its objects. These commands are primarily used by the DBA during the building and removal phases of a database project.

Data Manipulation Language: DML is used to retrieve, insert, modify and delete database information. These commands will be used by all database users during the routine operation of the database.

Usually, a database provides its own query/programming language to utilize these languages. However, nowadays, every DBMS supports the universal query language, named SQL to perform the definitive and manipulative functions.