Apznza 4
Apznza 4
Data
• Data is a small unit of information.
• It can be used in a variety of forms like text, numbers, media, bytes, etc. it can
be stored in pieces of paper or electronic memory, etc.
• Word 'Data' is originated from the word 'datum' that means 'single piece of
information.' It is plural of the word datum.
Database
• The collection of data, usually referred to as the database, contains information
relevant to an enterprise.
• A database is an organized collection of data, so that it can be easily accessed
and managed.
• You can organize data into tables, rows and columns to make it easier to find
relevant information.
Database-management system (DBMS)
• A database-management system (DBMS) is a collection of interrelated data and
a set of programs to access those data.
• Database management System is software which is used to store and retrieve
the database.
• For example, Oracle, MySQL, etc.; these are some popular DBMS tools.
• DBMS provides the interface to perform the various operations like creation,
deletion, modification, etc.
• DBMS allows the user to create their databases as per their requirement.
• It provides security to the database.
Applications of DBMS
• Databases are widely used. Here are some representative applications:
Enterprise Information
Sales:
For customer, product, and purchase information.
Accounting:
For payments, receipts, account balances, assets and other accounting information.
Human resources:
For information about employees, salaries, payroll taxes, and benefits, and for
generation of paychecks.
Manufacturing:
For management of the supply chain and for tracking production of items in
factories, inventories of items in warehouses and stores, and orders for items.
Online retailers:
For sales data noted above plus online order tracking, generation of
recommendation lists, and maintenance of online product evaluations.
Banking and Finance
Banking:
For customer information, accounts, loans, and banking transactions.
Credit card transactions:
For purchases on credit cards and generation of monthly statements.
Finance:
For storing information about holdings, sales, and purchases of financial
instruments such as stocks and bonds; also for storing real-time market data to
enable online trading by customers and automated trading by the firm.
Universities
For student information, course registrations, and grades (in addition to standard
enterprise information such as human resources and accounting).
Airlines
For reservations and schedule information. Airlines were among the first to use
databases in a geographically distributed manner.
Telecommunication
For keeping records of calls made, generating monthly bills, maintaining balances
on prepaid calling cards, and storing information about the communication
networks.
Purpose of database [DBMS vs file System]
1-Tier Architecture
• In this architecture, the database is directly available to the user. It means the
user can directly sit on the DBMS and uses it.
• Any changes done here will directly be done on the database itself.
• The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.
2-Tier Architecture
• The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with the
database at the server side.
• For this interaction, API's like: ODBC, JDBC are used.
• The user interfaces and application programs are run on the client-side.
• The server side is responsible to provide the functionalities like: query
processing and transaction management.
• To communicate with the DBMS, client-side application establishes a
connection with the server side.
3-Tier Architecture
• The 3-Tier architecture contains another layer between the client and server. In
this architecture, client can't directly communicate with the server.
• The application on the client-end interacts with an application server which
further communicates with the database system.
• End user has no idea about the existence of the database beyond the application
server. The database also has no idea about any other user beyond the application.
• The 3-Tier architecture is used in case of large web application.
Three schema Architecture
• The three schema architecture is also called ANSI/SPARC architecture or three-
level architecture.
• This framework is used to describe the structure of a specific database system.
• The three-schema architecture contains three-levels. It breaks the database
down into three different categories.
• The above diagram shows the DBMS architecture.
• Mapping is used to transform the request and response between various
database levels of architecture.
• In External / Conceptual mapping, DBMS transform the request from external
level to conceptual schema.
• In Conceptual / Internal mapping, DBMS transform the request from the
conceptual to internal level.
Objectives of Three Schema Architecture
• The main objective of three level architecture is to enable multiple users to
access the same data with a personalized view.
• It separates the user's view from the physical structure of the database. This
separation is desirable for the following reasons:
o The users of the database should not worry about the physical
implementation and internal workings of the database such as data
compression and encryption techniques, hashing, optimization of the
internal structures etc.
o All users should be able to access the same data according to their
requirements.
o DBA should be able to change the conceptual structure of the database
without affecting the user's view.
Data Independence
• Data independence can be explained using the three-schema architecture.
• Data independence refers characteristic of being able to modify the schema at
one level of the database system without altering the schema at the next higher
level.
1. Logical Data Independence
o Logical data independence refers characteristic of being able to change the
conceptual schema without having to change the external schema.
o Logical data independence is used to separate the external level from the
conceptual view.
o If we do any changes in the conceptual view of the data, then the user view
of the data would not be affected.
2. Physical Data Independence
o Physical data independence can be defined as the capacity to change the
internal schema without having to change the conceptual schema.
o If we do any changes in the storage size of the database system server, then
the Conceptual structure of the database will not be affected.
o Physical data independence is used to separate conceptual levels from the
internal levels.
Database users
• A primary goal of a database system is to retrieve information from and store
new information into the database.
• People who work with a database can be categorized as database users or
database administrators.
• There are four different types of database-system users, differentiated by the
way they expect to interact with the system.
• Different types of user interfaces have been designed for the different types of
users.
Naive users
• Naive users are unsophisticated users who interact with the system by invoking
one of the application programs that have been written previously.
• For example, a clerk in the university who needs to add a new instructor to
department A invokes a program called new hire.
• This program asks the clerk for the name of the new instructor, her new ID, the
name of the department (that is, A), and the salary.
• The typical user interface for naive users is a forms interface, where the user
can fill in appropriate fields of the form.
• Naive users may also simply read reports generated from the database.
Application programmers
• are computer professionals who write application programs.
• Application programmers can choose from many tools to develop user interfaces.
• Rapid application development (RAD) tools are tools that enable an application
programmer to construct forms and reports with minimal programming effort.
Sophisticated users
• interact with the system without writing programs. Instead, they form their
requests either using a database query language or by using tools such as data
analysis software.
• Analysts who submit queries to explore data in the database fall in this category.
Specialized users
• are sophisticated users who write specialized database applications that do not
fit into the traditional data-processing framework.
• Among these applications are computer-aided design systems, knowledgebase and
expert systems, systems that store data with complex data types (for example,
graphics data and audio data), and environment-modeling
systems. Database Administrator (DBA)
• One of the main reasons for using DBMSs is to have central control of both the
data and the programs that access those data.
• A person who has such central control over the system is called a database
administrator (DBA).
The functions of a DBA include:
Schema definition
• The DBA creates the original database schema by executing a set of data
definition statements in the DDL.
• The DBA carries out changes to the schema and physical organization to reflect
the changing needs of the organization, or to alter the physical organization to
improve performance.
Granting of authorization for data access.
• By granting different types of authorization, the database administrator can
regulate which parts of the database various users can access.
• The authorization information is kept in a special system structure that the
database system consults whenever someone attempts to access the data in the
system.
Routine maintenance.
Examples of the database administrator’s routine maintenance activities are:
• Periodically backing up the database, either onto tapes or onto remote servers,
to prevent loss of data in case of disasters such as flooding.
• Ensuring that enough free disk space is available for normal operations, and
upgrading disk space as required.
• Monitoring jobs running on the database and ensuring that performance is not
degraded by very expensive tasks submitted by some users
PART-II: Entity-Relationship model
ER model
• ER model stands for an Entity-Relationship model. This model is used to
define the data elements and relationship for a specified system.
• It develops a conceptual design for the database. diagram called an entity-
relationship diagram is used for graphical representation.
• Component of ER Model:
Entity:
• An entity may be any object, class, person or place. In the ER diagram, an
entity can be represented as rectangles.
• Consider an organization as an example- manager, product, employee,
department etc. can be taken as an entity.
• For example, suppose we design a school database. In this database, the
student will be an entity with attributes like address, name, id, age, etc.
Weak Entity
• An entity that depends on another entity called a weak entity.
• The weak entity is represented by a double rectangle.
2. Attribute
• The attribute is used to describe the property of an entity.
• Eclipse is used to represent an attribute.
• For example, id, age, contact number, name, etc. can be attributes of a
student.
Key Attribute
• The key attribute is used to represent the main characteristics of an entity. It
represents a primary key.
• The key attribute is represented by an ellipse with the text underlined.
Composite Attribute
• An attribute that composed of many other attributes is known as a composite
attribute.
• The composite attribute is represented by an ellipse, and those ellipses are
connected with an ellipse.
Multivalued Attribute
• An attribute can have more than one value. These attributes are known as a
multivalued attribute. The double oval is used to represent multivalued attribute.
• For example, a student can have more than one phone number.
Derived Attribute
• An attribute that can be derived from another attribute is known as a derived
attribute. It can be represented by a dashed ellipse.
• For example, A person's age changes over time and can be derived from another
attribute like Date of birth.
3. Relationship
• A relationship is used to describe the relation between entities. Diamond is used
to represent the relationship.
One-to-many relationship
• When only one instance of the entity on the left, and more than one instance of
an entity on the right associates with the relationship then this is known as a
one-to-many relationship.
• For example, Scientist can invent many inventions, but the invention is done by
the only specific scientist.
Many-to-one relationship
• When more than one instance of the entity on the left, and only one instance of
an entity on the right associates with the relationship then it is known as a
many-to-one relationship.
• For example, Student enrolls for only one course, but a course can have many
students.
Many-to-many relationship
• When more than one instance of the entity on the left, and more than one
instance of an entity on the right associates with the relationship then it is
known as a many-to-many relationship.
• For example, Employee can assign by many projects and project can have many
employees.