Mca DBMS - 1
Mca DBMS - 1
DATA/INFORMATION PROCESSING:
The process of converting the data (raw facts) into meaningful information is
called as data/information processing.
DATABASE:
A database is a collection of related data.
(OR)
A database is a collection of information that is organized so that it can be easily
accessed, managed and updated.
Examples / Applications of Database Systems:
The following are the various kinds of applications/organizations uses databases
for their business processing activities in their day-to-day life. They are:
1.Banking: For customer information, accounts, and loans, and banking
transactions.
2. Airlines: For reservations and schedule information. Airlines were among the
first to use
databases in a geographically distributed manner—terminals situated around the
world accessed the central database system through phone lines and other data
networks.
3.Universities: For student information, course registrations, and grades.
4.Credit Card Transactions: For purchases on credit cards and generation of
monthly statements.
5. Telecommunication: For keeping records of calls made, generating monthly
bills, maintaining balances on prepaid calling cards, and storing information
about the communication networks.
6. Finance: For storing information about holdings, sales, and purchases of
financial instruments such as stocks and bonds.
7. Sales: For customer, product, and purchase information.
8. Manufacturing: For management of supply chain and for tracking production
of items in factories, inventories of items in warehouses/stores, and order for
items.
9. Human resources: For information about employees, salaries, payroll taxes
and benefits, and for generation of paychecks.
10. Railway Reservation Systems: For reservations and schedule information.
11. Web: For access the Back accounts and to get the balance amount.
12. E –Commerce: For Buying a book or music CD and browse for things like
watches, mobiles from the Internet.
CHARACTERISTICS OF DATABASE: The database approach has some very
characteristic features which are discussed in detail below:
Structured and Described Data: Fundamental feature of the database approach
is that the database system does not only contain the data but also the complete
definition and description of these data. These descriptions are basically details
about the extent, the structure, the type and the format of all data and,
additionally, the relationship between the data. This kind of stored data is called
metadata or, data about data.
Separation of Data and Applications: Application software does not need any
knowledge about the physical data storage like encoding, format, storage place,
etc. It only communicates with the management system of a database (DBMS)
via a standardized interface with the help of a standardized language like SQL.
The access to the data and the metadata is entirely done by the DBMS. In this
way all the applications can be totally separated from the data.
Data Integrity: Data integrity is a byword for the quality and the reliability of the
data of a database system. In a broader sense data integrity includes also the
protection of the database from unauthorized access (confidentiality) and
unauthorized changes. Data reflect facts of the real world.
Transactions: A transaction is a bundle of actions which are done within a
database to bring it from one consistent state to a new consistent state. In
between the data are inevitable inconsistent. A transaction is atomic what
means that it cannot be divided up any further. Within a transaction all or none
of the actions need to be carried out. Doing only a part of the actions would lead
to an inconsistent database state. Example: One example of a transaction is the
transfer of an amount of money from one bank account to another.
Data Persistence: Data persistence means that in a DBMS all data is maintained
as long as it is not deleted explicitly. The life span of data needs to be
determined directly or indirectly be the user and must not be dependent on
system features. Additionally, data once stored in a database must not be lost.
Changes of a database which are done by a transaction are persistent. When a
transaction is finished even a system crash cannot put the data in danger.
TYPES OF DATABASES: Database can be classified according to the following
factors. They are:
1.Number of Users
2.Database Location
3.Expected type
4.Extent of use
1. Based on number of Users: According to the number of users the databases
can be classified into following types. They are:
a). Single user
b). Multiuser
Single user database:
Single user database supports only one user at a time.
Desktop or personal computer database is an example for single user
database.
Multiuser database:
Multi user database supports multiple users at the same time.
Workgroup database and enterprise databases are examples for multiuser
database.
Workgroup database: If the multiuser database supports relatively small number
of users (fewer than 50) within an organization is called as Workgroup database.
Enterprise database: If the database is used by the entire organization and
supports multiple users (more than 50) across many departments is called as
Enterprise database.
2. Based on Location: According to the location of database the databases can
be classified into following types. They are:
a)Centralized Database
b)Distributed Database
Centralized Database: It is a database that is located, stored, and maintained in
a single location. This location is most often a central computer or database
system, for example a desktop or server CPU, or a mainframe computer. In most
cases, a centralized database would be used by an organization (e.g. a business
company) or an institution (e.g. a university.)
Distributed Database: A distributed database is a database in which storage
devices are not all attached to a common CPU. It may be stored in multiple
computers located in the same physical location, or may be dispersed over a
network of interconnected computers.
INTRODUCTION TO DATABASE-MANAGEMENT SYSTEM:
Database Management System: A database-management system (DBMS) is a
collection of interrelated data and a set of programs to access those data.
The DBMS is a general purpose software system that facilitates the process of
defining constructing and manipulating databases for various applications.
Goals of DBMS:
The primary goal of a DBMS is to provide a way to store and retrieve database
information that is both convenient and efficient
1.Manage large bodies of information
2. Provide convenient and efficient ways to store and access information
3. Secure information against system failure or tampering
4. Permit data to be shared among multiple users
Properties of DBMS:
1.A Database represents some aspect of the real world. Changes to the real
world reflected in the database.
2.A Database is a logically coherent collection of data with some inherent
meaning.
3.A Database is designed and populated with data for a specific purpose.
Need of DBMS:
1. Before the advent of DBMS, organizations typically stored information using a
“File Processing Systems”.
Example of such systems is File Handling in High Level Languages like C, Basic
and COBOL etc., these systems have Major disadvantages to perform the Data
Manipulation. So to overcome those drawbacks now we are using the DBMS.
2.Database systems are designed to manage large bodies of information.
3. In addition to that the database system must ensure the safety of the
information stored, despite system crashes or attempts at unauthorized access.
If data are to be shared among several users, the system must avoid possible
anomalous results.
ADVANTAGES OF A DBMS OVER FILE SYSTEM:
Using a DBMS to manage data has many advantages: Data Independence:
Application programs should be as independent as possible from details of data
representation and storage. The DBMS can provide an abstract view of the data
to insulate application code from such details.
Efficient Data Access: A DBMS utilizes a variety of sophisticated techniques to
store and retrieve data efficiently. This feature is especially important if the data
is stored on external storage devices.
Data Integrity and Security: If data is always accessed through the DBMS, the
DBMS can enforce integrity constraints on the data. For example, before
inserting salary information for an employee, the DBMS can check that the
department budget is not exceeded. Also, the DBMS can enforce access controls
that govern what data is visible to different classes of users.
Concurrent Access and Crash Recovery: A database system allows several users
to access the database concurrently. Answering different questions from
different users with the same (base) data is a central aspect of an information
system. Such concurrent use of data increases the economy of a system. An
example for concurrent use is the travel database of a bigger travel agency. The
employees of different branches can access the database concurrently and book
journeys for their clients. Each travel agent sees on his interface if there are still
seats available for a specific journey or if it is already fully booked. A DBMS also
protects data from failures such as power failures and crashes etc. by the
recovery schemes such as backup mechanisms and log files etc.
Data Administration: When several users share the data, centralizing the
administration of data can offer significant improvements. Experienced
professionals, who understand the nature of the data being managed, and how
different groups of users use it, can be responsible for organizing the data
representation to minimize redundancy and fine-tuning the storage of the data
to make retrieval efficient.
Reduced Application Development Time: DBMS supports many important
functions that are common to many applications accessing data stored in the
DBMS. This, in conjunction with the high-level interface to the data, facilitates
quick development of applications. Such applications are also likely to be more
robust than applications developed from scratch because many important tasks
are handled by the DBMS instead of being implemented by the application.
DISADVANTAGES OF DBMS:
Danger of a Overkill: For small and simple applications for single users a
database system is often not advisable.
Complexity: A database system creates additional complexity and requirements.
The supply and operation of a database management system with several users
and databases is quite costly and demanding.
Qualified Personnel: `The professional operation of a database system requires
appropriately trained staff. Without a qualified database administrator nothing
will work for long.
Costs: Through the use of a database system new costs are generated for the
system itself but also for additional hardware and the more complex handling of
the system.
Lower Efficiency: A database system is a multi-use software which is often less
efficient than specialized software which is produced and optimized exactly for
one problem.
DATA MODELS: The entire structure of a database can be described using a
data model. A data model is a collection of conceptual tools for describing Data
models can be classified into following types.
1.Object Based Logical Models.
2.Record Based Logical Models.
3.Physical Models.
1.Object Based Logical Models: These models can be used in describing the data
at the logical and view levels. These models are having flexible structuring
capabilities classified into following types. a) The entity-relationship model. b)
The object-oriented model. c) The semantic data model. d) The functional data
model.
2.Record Based Logical Models: These models can also be used in describing the
data at the logical and view levels. These models can be used for both to specify
the overall logical structure of the database and a higher-level description. These
models can be classified into,
1. Relational model.
2. Network model.
3. Hierarchical model.
3. Physical Models: These models can be used in describing the data at the
lowest level, i.e. physical level. These models can be classified into 1. Unifying
model 2. Frame memory model.
Customer and Product are two entities. Customer number and name are
attributes of the Customer entity
Product name and price are attributes of product entity
Sale is the relationship between the customer and product
Conceptual
Data Model
Characteristics of a conceptual data model
Describes data needs for a single project but could integrate with other
logical data models based on the scope of the project.
Designed and developed independently from the DBMS.
Data attributes will have datatypes with exact precisions and length.
Normalization processes to the model is applied typically till 3NF.
Physical Data
Model
The physical data model describes data need for a single project or
application though it maybe integrated with other physical data models
based on project scope.
Data Model contains relationships between tables that which addresses
cardinality and nullability of the relationships.
Developed for a specific version of a DBMS, location, data storage or
technology to be used in the project.
Columns should have exact datatypes, lengths assigned and default
values.
Primary and Foreign keys, views, indexes, access profiles, and
authorizations, etc. are defined.
The main goal of a designing data model is to make certain that data
objects offered by the functional team are represented accurately.
The data model should be detailed enough to be used for building the
physical database.
The information in the data model can be used for defining the
relationship between tables, primary and foreign keys, and stored
procedures.
Data Model helps business to communicate the within and across
organizations.
Data model helps to documents data mappings in ETL process
Help to recognize correct sources of data to populate the model
Entity-Relationship model:
History:
Peter Chen is credited with introducing the widely adopted ER model in his paper
“The Entity Relationship Model-Toward a Unified View of Data“. The focus was on
entities and relationships and he introduced a diagramming representation for
database design as well.
His model was inspired by the data structure diagrams introduced by Charles
Bachman. One of the early forms of ER diagrams, Bachman diagrams are named
after him.
They are widely used to design relational databases. The entities in the ER
schema become tables, attributes and converted the database schema. Since
they can be used to visualize database tables and their relationships it’s
commonly used for database troubleshooting as well.
For example, an inventory software used in a retail shop will have a database
that monitors elements such as purchases, item, item type, item source and item
price. Rendering this information through an ER diagram would be something
like this:
Elements in ER diagrams
There are three basic elements in an ER Diagram: entity, attribute, relationship.
There are more elements which are based on the main elements. They are weak
entity, multi valued attribute, derived attribute, weak relationship, and recursive
relationship. Cardinality and ordinality are two other notations used in ER
diagrams to further define relationships.
Entity
Weak Entity
Attribute:
Derived Attribute:
Recursive Relationship:
1. Identify all the entities in the system. An entity should appear only
once in a particular diagram. Create rectangles for all entities and name
them properly.
2. Identify relationships between entities. Connect them using a line and
add a diamond in the middle describing the relationship.
3. Add attributes for entities. Give meaningful attribute names so they can
be understood easily.
1. Provide a precise and appropriate name for each entity, attribute, and
relationship in the diagram. Terms that are simple and familiar always
beats vague, technical-sounding words. In naming entities, remember to
use singular nouns. However, adjectives may be used to distinguish
entities belonging to the same class (part-time employee and full-time
employee, for example). Meanwhile attribute names must be meaningful,
unique, system-independent, and easily understandable.
2. Remove vague, redundant or unnecessary relationships between entities.
3. Never connect a relationship to another relationship.
4. Make effective use of colors. You can use colors to classify similar entities
or to highlight key areas in your diagrams.
ER Diagram Templates:
Below are some ER diagram templates so you can get started quickly. Clicking
on the image and in the new page that opens click the “Use as Template”
button. For more templates check our ER diagram templates section.
Benefits of ER diagrams:
Second, ER diagrams are readily translatable into relational tables which can be
used to quickly build databases. In addition, ER diagrams can directly be used by
database developers as the blueprint for implementing data in specific software
applications.
• Keys are attributes or sets of attributes that uniquely identify an entity within
its entity set.
• General constraints are arbitrary constraints that should hold in the database.
We will study some examples in the second half of the semester.
• Constraints are part of the schema of a database.
Express the number of entities to which another entity can be associated via a
relationship set.
For a binary relationship set the mapping cardinality must be one of the following
types:
One to one
One to many
Many to one
Many to many
(a)Many to One
(b)Many to Many
Cardinality Constraints:
One-to-one relationship:
A customer is associated with at most one loan via the relationship borrower
One-To-Many Relationship:
Many-To-One Relationships:
Many-To-Many Relationship:
Total participation (indicated by double line): every entity in the entity set
participates in at least one relationship in the relationship set
Partial participation: some entities may not participate in any relationship in the
relationship set
Roles:
The labels “manager” and “worker” are called roles; they specify how employee
entities interact via the works_for relationship set.
Roles are indicated in E-R diagrams by labeling the lines that connect diamonds
to rectangles.
Role labels are optional, and are used to clarify semantics of the relationship
We allow at most one arrow out of a ternary (or greater degree) relationship to
indicate a cardinality constraint
E.g. an arrow from works_on to job indicates each employee works on at most
one job at any branch.
If there is more than one arrow, there are two ways of defining the meaning.
2. each pair of entities from (A, B) is associated with a unique C entity, and each
pair (A, C) is associated with a unique B