Sie sind auf Seite 1von 5

COMP08/COMP12-PRELIMS 1/5

Introduction to Databases

Database Management System (DBMS) is a collection of interrelated data and a set of programs to access those data. Database
contains information related to the enterprise. Databases are designed to manage large bodies of information. Management of data
involves both defining structures for storage of information and providing mechanism for the manipulation of information.

Ex: Banking, Airlines, Universities, Credit card transactions & Sales.

Application of Database in Supermarket


When you purchase goods from supermarket, a product database is likely to be accessed. The Shopkeeper will run a barcode
reader over each of your products; this is linked to a database application program which uses this barcode to find out the price of
item from the products database.

The program then reduces the stock of that product. If reorder level falls beyond a particular value system automatically place
order for more stock of that item.

Application of Database in a Credit Card Transaction


When you purchase goods using credit card , a checking is done to find out if you have enough credit to purchase the item or not.
There is a database which is accessed then which stores the details of all the purchases you have made using your credit card. Your
purchase is added to the database.

A checking is done by comparing the prices of items purchased against sum of all the purchases you have already done this month.

Find Out:
Application of database in library
Application of database in University

Database Systems vs. File Systems

Manual Filing System


-Data is organized in different files, and labeled and kept in different storage areas. When we need to look for some information
we go to the required files and start searching from the first entry until we find what we want. This can used if the number of items
stored is small.

Disadvantages of file processing system:


1. Separation & Isolation of Data-When data is isolated in separate files it is more difficult to access data that should be available.
2. Duplication of Data-The same data will be stored in more than one place. Duplication is wasteful and costs lots of money and
time.
3. Data Dependence-If you make change to any data all the dependent files having the same data has to be changed.

Database Approach
-A shared collection of logically related data designed to meet the information needs of an organization. Instead of using
disconnected files with redundant data all data is integrated with minimum amount of duplication. The data is no longer used by
one department. A database is a self describing collection of integrated records and its called system catalog, metadata or data
dictionary.

One major advantage of a Database approach is that users see only the external definition and is unaware of how object is defined
and how it functions. This approach is called data abstraction, which means we can change the internal definition of object
without affecting the users of the object.

DBMS (Database Management Systems)


-A software system which helps users to create, define and maintain the database and provide controlled access to database
COMP08/COMP12-PRELIMS 2/5

Components of DBMS
There are 5 major components of a Database Environment
• Hardware
• Software
• Data
• Procedure
• People

Hardware-The DBMS and applications require hardware to run. The hardware can range from single personal computer to a
network of computers. The particular hardware depends on organizations requirements and the DBMS used.

Software-The software component comprises the DBMS software itself and the application programs together with the operating
system including network software if DBMS is used over a network.

Data-The database has operational data and metadata (data about data).The structure of database is called schema.

Procedures-It refers to the instructions and rules that govern the design and use of database.

People-The users of the database

Database access from Application programs


Application programs are programs that are used to interact with the database. They present the required information to the user
from the database without displaying the details of the database. E.g. Visual Basic

Roles in a Database Environment


• Data and Database Administrator
• Database designers
• Application programmers
• End users

Database Administrator
-One of the main reasons for using database is to have central control of both the data and the programs that access those data. A
person who has such a central control over the system is called a DBA.

The functions of DBA are:


1. Physical database design and implementation
2. Security
3. Ensure good performance for applications and users

Database Designers
-Logical database designers: They identify the data, relationship between data, constraints on the data.
-Physical database designer-He takes the logical data model and decides how it is physically realized. Mapping logical data to a
set of tables & enforce security measures.

Application Programmers
-Once the database has been implemented, application programmer provides the required functionality for the end user. They write
the statements to manipulate the data from the database.

Database Users
There are two different types of database system users, differentiated by the way they are expected to interact with the system.
1. Naive Users: totally unaware of the database. They access the database through the application program
2. Sophisticated Users: They know the structure of database and the facilities offered by the database.
COMP08/COMP12-PRELIMS 3/5

Advantages of DBMS
1. Control of data redundancy: Data is just stored at one place and is accessed from there
2. Data consistency: As the data is stored only at place an updating is performed only once and new value is available for all
the users.
3. Sharing of data
4. Improved data integrity: refers to validity and consistency of stored data.
5. Improved security: Protection of database from unauthorized access.
6. Improved backup

Disadvantages of DBMS
1. Complexity: All the users and developers should understand the functionality to take full advantage of it.
2. Size: It takes lots of memory.
3. Cost: High impact on failure.

Database Environment

Views of data
A major purpose of a database system is to provide users with an abstract view of the data. That is, the system hides certain details
of how data are stored and maintained.

Data Abstraction
• Physical level or Internal Level
• Logical level or Conceptual Level
• View level or External Level

Physical level or Internal Level--This is lowest level of abstraction describes how the data are actually stored. It describes the
complex level data structures. It is concerned with things like
• storage space allocation for data and indexes
• record description for storage
• record placement
• data compression

Logical level or Conceptual level--This describes what data is stored in the database and the relationships among data.
• It represents all entities, attributes and their relationship
• The constraints on the data
• Security information

External Level or View Level--The user's view of database. This level describes the part that is relevant to each user. This is the
highest level of abstraction. This describes different views of the database.

Instances & schemas


Database changes over time as information is inserted and deleted. The collection of information stored in the database at a
particular moment is an instance of the database. The overall design of the database is the database schema. Database can have
various schemas.

The physical schema describes the database design at the physical level, logical schema defines database at the logical level.
Different views of database described in subschema. The physical schema is hidden beneath the logical schema and can be easily
changed without affecting the application program.

The data in the database at any point of time is called database instance.
COMP08/COMP12-PRELIMS 4/5

Data model
-Data model is a collection of conceptual tools for describing data, data relationships, data semantics, and consistency constraints.

Physical Data Model - describes how data is stored in a computer, representing information such as record structures, record
orderings and access path.

Record data model - In this model data is organized in the form of records with a fixed number of fields.
3 types of record-based models:
• Hierarchical model
• Relational model
• Object-based Model

Hierarchical model - Data is represented as a collection of records and relationships as sets. Represented as a tree structure each
node is allowed to have only one parent.

Relationship model - The E-R model based on the perception that the real world consists of basic objects called entities, and
relationship among these entities. Entities are described in the database by a set of attributes. A relationship is an association
among various entities.

An E-R diagram that is built of following components can express the overall logical structure of a database graphically:
• Rectangles, which represent entity sets
• Ellipses, which represent attributes
• Diamonds, which represent relationships among entity sets
• Lines, which link attributes to entity sets and entity sets to relationships
• Each component is labeled with entity or relationship it represents.

The Relational model -uses collection of tables to represent both data and the relationships among these data. Each table has
multiple columns and each column has unique name. It is based on mathematical relations.

Object-based Model - This model is an extension of E-R model.

Object-relational data model combines the features of the object-oriented model and relational model.

Database Languages
A database system provides a data definition language and a data manipulation language.

Data Definition Language (DDL)


- Used to specify the database schema. It allows the users to define a database, specify the data type, structure, constraints on the
data stored in the database

The database schema is specified by a set of definitions expressed by a special language called a DDL.

When a table is defined in DDL, a data dictionary or data directory is created. A data dictionary contains metadata-data about data.

A database consults data dictionary before adding or modifying actual data called system catalog.

A special type of DDL called data storage and definition language specifies storage structures and access methods used by
database system. The data values stored in the database must satisfy certain consistency constraints.

The result of compilation of the DDL statements is a set of tables stored in a specific file collectively.
COMP08/COMP12-PRELIMS 5/5

Data Manipulation Language (DML)


-This allows the users to manipulate the data stored like insert, update, delete or retrieve data.

A DML is the language that enables users to access or manipulate data as organized by the appropriate data model.

They are of two types:


1. Procedural DML: requires user to specify what data are needed and how to get the data. It manipulates the database
record by record.
2. Declarative DML: requires user to specify what data are needed without specifying how to get those data. It can operate
on sets of records. E.g. SQL

Query is a statement requesting the retrieval of information. The portion of a DML that involves information retrieval is called a
query language.

4GL
-It stands for 4th generation Languages. This is a non-procedural language. Some features of 4GL are presentation languages like
query language and report generators specialty languages like spreadsheets and database languages.

Form Generators: It allows the user to define what the screen looks like, what information is to be displayed and where on the
screen it should be displayed.

Report Generators: It provides the facility to create reports from data stored in the database.

Graphics Generators: It helps to retrieve data from the database and display the data as a graph.

Views: Another feature provided by most databases is View Mechanism, which allows users to have their own view of the
database.