DBMS 2 Chapter
DBMS 2 Chapter
1) INTRODUCTION:
Database: Is said to be a collection of related data.By data, we mean known facts that can be recorded and that have
implicit meaning.and a database management system (DBMS) to be the software that manages and controls access to the database.The
DBMS is a general-purpose software system that facilitates the processes of defining, constructing, manipulating, and sharing databases
among various users and applications. A database application is simply a program that interacts with the database at some point in its
execution. We also use the more inclusive term database system as a collection of application programs that interact with the database
along with the DBMS and the database itself.
Example:
Studying at College
If you are at college, there will be a database system containing information about yourself, your major and minor fields, the courses you
are enrolled in, details about your financial aid, the classes you have taken in previous years or are taking this year, and details of all your
examination results. There may also be a database containing details relating to the next year’s admissions and a database containing
details of the staff working at the university, giving personal details and salary related details for the payroll office.
1. Hardware:
The DBMS and application program requires a hardware to run.Particular hardware depends on organization’s requirements
and DBMS used. Some DBMS run only on particular hardware or operating systems, while others run on a wide variety of
hardware and operating systems.. A DBMS requires a minimum amount of main memory and disk space to run, but this
minimum configuration may not necessarily give acceptable performance.
2. Software:
Software components include DBMS software itself and application programs together with operating systems including
network software if DBMS is online.Applications programs are written in third-generation lanaguage (3GL)[C,C++,C#,Java,
Visual Basic etc or fourth-generation language (4GL) such as SQL, embedded in 3GL. Target DBMS may have its own fourth-
generation tools that allow rapid development.
3. Data:
Most important component of DBMS environment- certainly from end-users’ point of view- is the data. The database contains
both the operational data and the metadata(data about data). The structure of database is called the Schema.
Data is central for storage, retrieval, and organization. It ensures integrity, security, and supports decision-making processes by
providing a reliable source for analysis and insights.
4. Procedures:
Procedures refer to the instructions and rules that govern the design and use of the database. The users of the system and the
staff who manage the database require documented procedures on how to use or run the system.
5. People:
The final component is the people involved with the system.
1.2.5) Database Design: The Paradigm Shift:
The structure of the database is determined during database design.Carrying out database design can be extremely complex. To produce a
system that will satisfy the organization’s information needs requires a different approach from that of file-based systems, where the work
was driven by the application needs of individual departments. For the database approach to succeed, the
organization now has to think of the data first and the application second. This change in approach is sometimes referred to as a
paradigm shift. For the system to be acceptable to the end-users, the database design activity is crucial. A poorly designed database will
generate errors that may lead to bad decisions, which may have serious repercussions for the organization. On the other hand, a well-
designed database produces a system that provides the correct information for the decision making process to succeed in an efficient way.
1.3) Roles in the Database Environment:
1.3.1) Data and Database Administrators:
Data Administrator (DA) is responsible for the management of the data resource, including database planning; development and
maintenance of standards, policies and procedures; and conceptual/logical database design. Their duties include ensuring data integrity,
security, and optimal performance, as well as overseeing database design, implementation, and troubleshooting.
Data Base Administrators(DBA) is responsible for the physical realization of the database, including physical database design and
implementation, security and integrity control, maintenance of the operational system, and ensuring satisfactory performance of the
applications for users.The role of the DBA is more technically oriented than the role of the DA, requiring detailed knowledge of the
target DBMS and the system environment.
1.3.2) Database Designers:
In large database design projects, we can distinguish between two types of designer: logical database designers and physical database
designers.
The Logical database designer is concerned with identifying the data (that is, the entities and attributes), the relationships between the
data, and the constraints on the data that is to be stored in the database.Logical database designers must have the complete understandings
of organization’s data and its constraints(business rules).These constraints describe the main characteristics of data.
The Physical database designer decides how logical design database is to be physically realized:
mapping the logical database design into a set of tables and integrity constraints.
selecting specific storage structures and access methods for the data to achieve
good performance
designing any security measures required on the data.
the physical database designer must be fully aware of the functionality of the target DBMS and must understand the advantages and
disadvantages of each alternative implementation. The physical database designer must be capable of selecting a suitable storage strategy
that takes account of usage
1.3.3) Application Developers:
After database implementation,the application program must provide the required functionality for end-users.This is the responsibility of
application developers.Application developers work from a specification produced by system analysts.Each program contains statements
that request the DBMS to perform some operation on the database,which includes retrieving data,inserting,updating and deleting data.
Programs may be written in third-generation or fourth-generation programming language.
1.3.4) End-users:
The end-users are the “clients” of the database, which has been designed and implemented and is being maintained to serve their
information needs.
Naïve users are unaware of the DBMS. They access the database through special wriiten application progamsr that attemp to make the
opeation as simple as possible for the users. They operate database by entering simple commands or choosing options from menu.this
means that they don’t need to know anything about database or DBMS.
For example, the checkout assistant at the local supermarket uses a bar code reader to find out the price of the item. However, there is an
application program present that reads the bar code, looks up the price of the item in the database, reduces the database field containing
the number of such items in stock, and displays the price on the till.
Sophisticated users ,the sophisticated end-user is familiar with the structure of the database and the facilities offered by the DBMS.
Sophisticated end-users may use a high-level query language such as SQL to perform the required operations. Some sophisticated end-
users may even write application programs for their own use.
1.4) History of DataBase Management System:
Read in page no. 72. Hierarchial strucutures.
the network schema—the logical organization of the entire database as seen by the DBA—which includes a definition of the
database name, the type of each record, and the components of each record type.
the subschema—the part of the database as seen by the user or application program.
a data management language to define the data characteristics and the data structure, and to manipulate the data.
Disadvantages:
1. Complexity:
The provision of the functionality that we expect of a good DBMS makes the DBMS an extremely complex piece of software.
Database designers and developers, data and database administrators, and end-users must understand this functionality to take full
advantage of it. Failure to understand the system can lead to bad design decisions, which can have serious consequences for an
organization.
2. Size:
The complexity and breadth of functionality makes the DBMS an extremely large piece of software, occupying many megabytes of
disk space and requiring substantial amounts of memory to run efficiently.
3. Cost of DBMSs:
The cost of DBMSs varies significantly, depending on the environment and functionality provided. For example, a single-user DBMS
for a personal computer may only cost $100. However, a large mainframe multi-user DBMS servicing hundreds of users can be
extremely expensive, perhaps $100,000 or even $1,000,000. There is also the recurrent annual maintenance cost, which is typically a
percentage of the list price.
4. Additional Hardware Costs:
The disk storage requirements for the DBMS and the database may necessitate the purchase of additional storage space. Furthermore,
to achieve the required performance, it may be necessary to purchase a larger machine, perhaps even a machine dedicated to running
the DBMS.
5. Cost of Conversion:
In some situations, the cost of the DBMS and extra hardware may be relatively small compared with the cost of converting existing
applications to run on the new DBMS and hardware. This cost also includes the cost of training staff to use these new systems, and
possibly the employment of specialist staff to help with the conversion and running of the systems. That’s why many organization feel
tired to upgrade to the latest system.
6. Performance:
File-based system is written for a specific application, such as invoicing. As a result, performance is generally very good. However,
the DBMS is written to be more general, to cater for many applications rather than just one. The result is that some applications may
not run as fast as they used to.
7. Greater Impact of a Failure:
The centralization of resources increases the vulnerability of the system. Because all users and applications rely on the availability of
the DBMS, the failure of certain components can bring operations to a halt.
CHP # 2 DATABASE ENVIRONMENT
2) INTRODUCTION:
Structure of Database means the data types, realtionships & constraints.
the “real-world” entities Staff, PropertyforRent, PrivateOwner, and Client;
attributes describing properties or qualities of each entity (for example, each Staff entry has a name, position, and salary);
relationships between these entities (for example, Staff Manages PropertyforRent). Furthermore, because a database is a shared
resource, each user may require a different view of the data held in the database.
Data abstraction generally refers to the suppression of details of data organization and storage, and the highlighting of the essential
features for an improved understanding of data. One of the main characteristics of the database approach is to support data
abstraction so that different users can perceive data at their preferred level of detail. A data model—a collection of concepts that
can be used to describe the structure of a database—provides the necessary means 2 to achieve this abstraction.
Most data models also include a set of basic operations for specifying retrievals and updates on the database. In addition to the
basic operations provided by the data model, it is becoming more common to include concepts in the data model to specify the
dynamic aspect or behavior of a database application. This allows the database designer to specify a set of valid user-defined
operations that are allowed on the database objects.
Representational Data Models which provide concepts that may be easily understood by end users but that are not too far removed
from the way data is organized in computer storage. Representational data models hide many details of data storage on disk but can
be implemented on a computer system directly.1)Hierarchial Model 2)Relational Data Model
The description of a database is called the database schema, which is specified during database design and is not expected to change
frequently. Most data models have certain conventions for displaying schemas as diagrams.A displayed schema is called a schema
diagram.
valid state—in DBMS that is, a state that satisfies the structure and constraints specified in the schema.
The DBMS stores the descriptions of the schema constructs and constraints—also called the meta-data—in the DBMS catalog so
that DBMS software can refer to the schema whenever it needs to.
The schema is sometimes called the intension, and a database state is called an extension of the schema.
The data in the database at any particular point in time is called a database instance.
2.1) Three-Level ANSI-SPARC Architecture:
2.1.1) External-Level:
The external or view level includes a number of external schemas or user views. Each external schema describes the part of the database
that a particular user group is interested in and hides the rest of the database from that user group. As in the previous level, each external
schema is typically implemented using a representational data model, possibly based on an external schema design in a high-level
conceptual data model.
2.1.2) Conceptual-Level:
The conceptual level has a conceptual schema, which describes the structure of the whole database for a community of users. The
conceptual schema hides the details of physical storage structures and concentrates on describing entities, data types, relationships, user
operations, and constraints. Usually, a representational data model is used to describe the conceptual schema when a database system is
implemented.The conceptual level represents:
all entities, their attributes, and their relationships
the constraints on the data
security and integrity information.
2.1.3) Internal_Level:
The internal level has an internal schema, which describes the physical storage structure of the database. The internal schema uses a
physical data model and describes the complete details of data storage and access paths for the database.Internal is concerned with:
storage space allocation for data and indexes
record descriptions for storage (with stored sizes for data items)
record placement
data compression and data encryption techniques.
Below the internal level there is a physical level that may be managed by the operating system under the direction of the DBMS.
However, the functions of the DBMS and the operating system at the physical level are not clear-cut and vary from system to system.
Some DBMSs take advantage of many of the operating system access methods, and others use only the most basic ones and create their
own file organizations. The physical level below the DBMS consists of items that only the operating system knows, such as exactly how
the sequencing is implemented and whether the fields of internal records are stored as contiguous bytes on the disk.
2.1.4) Schemas,Mapping and Instances:
The overall description of the database is called the database schema.At the highest level, we have multiple external schemas (also called
sub-schemas)that correspond to different views of the data. At the conceptual level, we have the conceptual schema, which describes all
the entities, attributes, and relationships together with integrity constraints. At the lowest level of abstraction we have the internal schema,
which is a complete description of the internal model, containing the definitions of stored records, the methods of representation, the data
fields, and the indexes and storage structures used.
Sufyan6677
LOGICAL DATA INDEPENDENCE: is the capacity to change the conceptual schema without having to change external
schemas or application programs. We may change the conceptual schema to expand the database (by adding a record type or data
item), to change constraints, or to reduce the database (by removing a record type or data item). In the last case, external schemas
that refer only to the remaining data should not be affected. Changes to the conceptual schema, such as the addition or removal of
new entities, attributes, or relationships, should be possible without having to change existing external schemas or having to rewrite
application programs.
PHYSICAL DATA INDEPENDENCE: Is the capacity to change the internal schema
without having to change the conceptual schema. Hence, the external schemas need not be changed as well. Changes to the internal
schema may be needed because some physical files were reorganized—for example, by creating additional access structures— to
improve the performance of retrieval or update. If the same data as before remains in the database, we should not have to change the
conceptual schema.
2.2) Database Languages:
2.2.1) The Data-Definition Language(DDL):
A languagethatallowstheDBAorusertodescribeandnametheentities, attributes, and relationships required for the application, together with
any associated integrity and security constraints.The DDL is used to define a schema or to modify an existing one. It cannot be used to
manipulate data.The result of the compilation of the DDL statements is a set of tables stored in special files collectively called the system
catalog. The system catalog integrates the metadata, which is data that describes the objects in the database and makes it easier for those
objects to be accessed or manipulated. The metadata contains definitions of records, data items, and other objects that are of interest to
users or are required by the DBMS. The DBMS normally consults the system catalog before the actual data is accessed in the database.
The terms data dictionary and data directory are also used to describe the system catalog, although the term “data dictionary” usually
refers to a more general software system than a catalog for a DBMS.storage definition language (SDL)
view definition language (VDL).
2.2.2) The Data-Manipulation Language(DML):
When database is populated with data, users must have some means to manipulate the database. Typical manipulations
include retrieval, insertion, deletion, and modification of the data. The DBMS provides a set of operations or a language called the data
manipulation language (DML) for these purposes.Data manipulation operations usually include the following:
Insertion of new data into the database.
Modification of data stored in the database.
Retrieval of data contained in the database.
Deletion of data from the database.
The part of a DML that involves data retrieval is called a query language. A query language can be defined as a high-level special-
purpose language used to satisfy diverse requests for the retrieval of data held in the database.
Procedural DML:
A lowlevel or procedural DML must be embedded in a general-purpose programming language. This type of DML typically
retrieves individual records or objects from the database and processes each separately. Therefore, it needs to use programming
language constructs, such as looping, to retrieve and process each record from a set of records.
Non-Procedural DML:
A high-level or nonprocedural DML can be used on its own to specify complex database operations concisely. Many DBMSs allow
high-level DML statements either to be entered interactively from a display monitor or terminal or to be embedded in a general-
purpose programming language.
2.2.3) Fourth-Generation Languages(4GL)(Non-procedural):
Fourth Generation Language, is a high-level programming language designed for rapid application development and database
management, featuring a more natural, human-readable syntax. Examples include SQL for databases and tools like
PowerBuilder.Compared with a 3GL, which is procedural, a 4GL is nonprocedural: the user defines what is to be done, not how. A 4GL
is expected to rely largely on much higher-level components known as fourth-generation tools. The user does not define the steps that a
program needs to perform a task, but instead defines parameters for the tools that use them to generate an application program. It is
claimed that 4GLs can improve productivity by a factor of ten, at the cost of limiting the types of problem that can be tackled. Fourth-
generation languages encompass:
• presentation languages, such as query languages and report generators;
• speciality languages, such as spreadsheets and database languages;
• application generators that define, insert, update, and retrieve data from the
database to build applications;
• very high-level languages that are used to generate application code.
Form Generators:A forms generator is an interactive facility for rapidly creating data input and display layouts for screen forms.
The forms generator allows the user to define what the screen is to look like, what information is to be displayed, and where on the
screen it is to be displayed. It may also allow the definition of colors for screen elements and other characteristics such as bold,
underline, blinking, reverse video.
Report Generators: It’s a facility for creating reports from data stored in database. It’s similar to query language that allows users
to ask questions and retrieve information from data for report. However, in case of report generator , we have much greater control
over what the output look like.Report generators can automatically determine how output should look or we can create our own
customized output using special report-generator command instructions. Language-oriented, Visually-oriented.
Graphics Generators:A graphics generator is a facility to retrieve data from the database and display the data as a graph showing
trends and relationships in the data. Typically, it allows the user to create bar charts, pie charts, line charts, scatter charts, and so on.
Application Generators:An application generator is a facility for producing a program that interfaces with the database. The use
of an application generator can reduce the time it takes to design an entire software application. Application generators typically
consist of prewritten modules that comprise fundamental functions.The user specifies what the program is supposed to do; the
application generator determines how to perform the tasks.
2.2.4) DBMS Interfaces:
Menu-Based Interfaces for web clients and servers: Menu-based interfaces in DBMS for web clients involve users navigating through
web-based menus to interact with databases. They offer a user-friendly, guided approach suitable for individuals less familiar with
complex query languages. While easy to use, they may have limited flexibility compared to more advanced interfaces.
Apps For Mobile Devices: Mobile DBMS apps are applications on smartphones that facilitate interactions with databases. They enable
users to query, update, and view information, providing a convenient and accessible platform for managing data on mobile devices.
Form Based Interfaces: Form-based interfaces in DBMS involve users interacting with databases through structured forms on screens,
simplifying data entry and retrieval processes. They provide a user-friendly approach to input and retrieve information.
Graphical User Interface: Graphical User Interface (GUI) in DBMS interfaces employs visual elements like icons and windows,
enhancing user interactions with databases through intuitive, graphical representations, facilitating easier navigation and data
manipulation.
Natural Language Interface: Natural Language Interfaces in DBMS enable users to interact with databases using everyday language,
allowing queries and commands to be expressed in a more human-like manner, simplifying communication between users and databases.
They aim to make database interactions more accessible and user-friendly.
Keyword-Based Data Search: Keyword-based data search interfaces in DBMS allow users to search and retrieve information by entering
specific keywords, streamlining the process of locating relevant data within the database. They provide a quick and efficient way to find
and access specific information.
Speech & Input Interface: Speech input and output interfaces in DBMS enable users to interact with databases using spoken language,
allowing vocal commands for tasks like querying and receiving spoken responses, enhancing accessibility and hands-free operation. They
provide a convenient and inclusive way for users to engage with database systems.
Interfaces For Parametric Users: Interfaces for parametric users in DBMS cater to users who require customizable parameters, allowing
them to tailor the interface to their specific needs, providing flexibility and personalized control over database interactions. These
interfaces are designed to accommodate varied user preferences and requirements.
Interfaces For The DBA: DBMS interfaces for Database Administrators (DBA) provide advanced tools and functionalities for managing
and administering databases, offering features like performance monitoring, security configuration, and database optimization to facilitate
efficient database management. They empower DBAs with specialized tools for maintaining and overseeing the database infrastructure.
Data Modeling and Conceptual Modeling:
Data Model: An integrated collection of concepts for describing and manipulating data, relationships between data, and constraints on
the data in an organization.
A data model can be thought of as comprising three components:
(1) a structural part, consisting of a set of rules according to which databases can be constructed.
(2) a manipulative part, defining the types of operation that are allowed on the data (this includes the operations that are used for
updating or retrieving data from the database and for changing the structure of the database).
(3) a set of integrity constraints, which ensures that the data is accurate.
2.2.5) Objects-Based Data Models:
Object-based data models use concepts such as entities, attributes, and relationships. An entity is a distinct object (a person, place, thing,
concept, event) in the organization that is to be represented in the database. An attribute is a property that describes some aspect of the
object that we wish to record, and a relationship is an association between entities.The object-oriented data model extends the definition
of an entity to include not only the attributes that describe the state of the object but also the actions that are associated with the object,
that is, its behavior. The object is said to encapsulate both state and behavior.
2.2.6) Record-Based Data Models:
In a record-based model, the database consists of a number of fixed-format records, possibly of differing types. Each record type defines
a fixed number of fields, typically of a fixed length. There are three principal types of record-based logical data model: the relational data
model, the network data model, and the hierarchical data model.
Relational Data Model:
The relational data model is based on the concept of mathematical relations. In the relational model, data and relationships are
represented as tables, each of which has a number of columns with a unique name.
Network Data Model:
The network data model is a type of data model used in databases where data is represented as records connected in a graph-like structure.
It emphasizes relationships between entities and allows for more complex and interconnected data representations compared to the
simpler tabular structure of the relational data model.
Hierarchial Data Model:
The hierarchical data model is a database model where data is organized in a tree-like structure, with parent-child relationships
represented hierarchically. Each record has a single parent, except for the root record, fostering a clear and ordered representation of data
relationships.