DBMS V Unit (DBMS)
DBMS V Unit (DBMS)
DBMS V Unit (DBMS)
Database:
A database is a collection of information that is organized so that it can
easily be accessed, managed, and updated.
Database Management System (DBMS):
DataBase Management System (DBMS) is a software package that allows
data to be effectively stored, retrieved and manipulated and the data stored in
a DBMS packege can be accessed by multiple users and by multiple
application programs like (SQL Server, Oracle, Ms-Access) .
File-based System
File-based systems were an early attempt to computerize the manual filing
system. File-based system is a collection of application programs that
perform services for the end-users. Each program defines and manages its
data.
However, five types of problem are occurred in using the file-based
approach:
2. Duplication of data
When employing the decentralized file-based approach, the uncontrolled
duplication of data is occurred. Uncontrolled duplication of data is
undesirable because:
i. Duplication is wasteful
ii. Duplication can lead to loss of data integrity
3. Data dependence
Using file-based system, the physical structure and storage of the data files
and records are defined in the application program code. This characteristic
is known as program-data dependence. Making changes to an existing
structure are rather difficult and will lead to a modification of program.
Such maintenance activities are time-consuming and subject to error.
Database Approach:
In order to overcome the limitations of the file-based approach, the concept
of database and the Database Management System (DMS) was emerged in
60s.
Advantages
A number of advantages of applying database approach in application system
are obtained including:
2. Data consistency
By eliminating or controlling redundancy, the database approach reduces the
risk of inconsistencies occurring. It ensures all copies of the data are kept
consistent.
3. More information from the same amount of data
With the integration of the operated data in the database approach, it may be
possible to derive additional information for the same data.
4. Sharing of data
Database belongs to the entire organization and can be shared by all
authorized users.
6. Improved security
Database approach provides a protection of the data from the unauthorized
users. It may take the term of user names and passwords to identify user
type and their access right in the operation including retrieval, insertion,
updating and deletion.
7. Enforcement of standards
The integration of the database enforces the necessary standards including
data formats, naming conventions, documentation standards, update
procedures and access rules.
8. Economy of scale
Cost savings can be obtained by combining all organization's operational
data into one database with applications to work on one source of data.
Disadvantages
In split of a large number of advantages can be found in the database
approach, it is not without any challenge. The following disadvantages can
be found including:
1. Complexity
Database management system is an extremely complex piece of software.
All parties must be familiar with its functionality and take full advantage of
it. Therefore, training for the administrators, designers and users is required.
2. Size
The database management system consumes a substantial amount of main
memory as well as a large number amount of disk space in order to make it
run efficiently.
3. Cost of DBMS
A multi-user database management system may be very expensive. Even
after the installation, there is a high recurrent annual maintenance cost on the
software.
4. Cost of conversion
When moving from a file-base system to a database system, the company is
required to have additional expenses on hardware acquisition and training
cost.
5. Performance
As the database approach is to cater for many applications rather than
exclusively for a particular one, some applications may not run as fast as
before.
DBMS Architecture:
1. External view: This is a highest level of abstraction as seen by user. This
level of abstraction describes only the part of entire database. It is based on
the conceptual model, is the end user view of data environment. Each
external view described by means of a schema called an external schema or
subschema.
Database models
E-R Model
Relational Model
Network Model
Hierarchy model
The most popular high-level conceptual data model is the ER model. It is frequently used
for the conceptual design of database applications.
Composite attributes can be divided into smaller subparts, which represent more basic
attributes, which have their own meanings.
Attributes that are not divisible into subparts are called simple or atomic attributes.
Composite attributes can be used if the attribute is referred to as the whole, and the
atomic attributes are not referred to. For example, if you wish to store the Company
Location, unless you will use the atomic information such as Postal Code, or City
separately from the other Location information (Street Address etc) then there is no
need to subdivide it into its component attributes, and the whole Location can be
designated as a simple attribute.
What are examples of other composite attributes?
Most attributes have a single value for each entity, such as a car only has one model, a
student has only one ID number, an employee has only one data of birth. These
attributes are called single-valued attributes.
Sometimes an attribute can have multiple values for a single entity, for example, a
doctor may have more than one specialty (or may have only one specialty), a
customer may have more than one mobile phone number, or they may not have one at
all. These attributes are called multi-valued attributes.
Multi-valued attributes may have a lower and upper bounds to constrain the number
of values allowed. For example, a doctor must have at least one specialty, but no
more than 3 specialties.
E.g.
{AddressPhone({Phone(AreaCode, PhoneNumber)}, Address(StreetAddress(Number,
Street, ApartmentNumber), City, State, Zip))}
ER Diagram Notation
- Entity
- Attribute
- Multi-valued Attribute
- Composite Attributes
Key Attributes
The company database keeps track of a company’s employees, departments and projects.
Suppose that after the requirements collection and analysis phase, the database designers
provided the following description of the part of the company to be represented by the
database.
5. The company is organized into department. Each department has a unique name a
unique number and a particular employee who manages the department. We keep
track of the start date when that employee began managing the department. A
department may have several locations.
6. A department controls a number of projects, each of which has a unique name, a
unique number and a single location.
7. We store each employees name, ID number, address, salary, sex and birth date.
An employee is assigned to one department but may work on several projects,
which are not necessarily controlled by the same department. We keep track of
the number of hours per week that an employee works on each project. We also
keep track of the direct supervisor of each employee.
8. We want to keep track of the dependents of each employee for insurance purposes.
We keep each dependent’s first name, sex, birth date and relationship to the
employee.
Role Names
16. Each entity type that participates in a relationship type plays a particular role in the
relationship.
17. The role name shows the role that an particular entity from the entity type plays in
each relationship.
18. Example: In the Company diagram, in the Works For relationship type, the employee
plays the role of employee or worker, and the department entity plays the role of
department or employer.
19. In some cases the same entity participates more than once in a relationship type in
different roles.
20. For example, the Supervision relationship type relates an employee to a supervisor,
where both the employee and supervisor are of the same employee entity type,
therefore the employee entity participates twice in the relationship, once in the role of
supervisor, and once in the role of supervise.
Database Languages:(SQL- Structured Query Language)
DDL:
Data Definition Language (DDL) is a standard for commands that define the different
structures in a database. DDL statements create, modify, and remove database objects
such as tables, indexes, and users.
CREATE - to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
DML
DML is short name of Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT, INSERT,
UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update data
in a database.
TCL
TCL is short name of Transaction Control Language which deals with a transaction within
a database.
Primary Key:-A primary key is a special relational database table column (or combination
of columns) designated to uniquely identify all table records.
A primary key’s main features are:
A primary key is either an existing table column or a column that is specifically generated
by the database according to a defined sequence.
Depending on the company and the department, this role can either be highly specialized
or incredibly diverse. The primary role of the Database Administrator is to adminster,
develop, maintain and implement the policies and procedures necessary to ensure the
security and integrity of the corporate database. Sub roles within the Database
Administrator classification may include security, architecture, warehousing and/or
business analysis. Other primary roles will include:
Database schema
Schema objects
Indexes
Tables
Fields and columns
Records and rows
Keys
Relationships
Data types