You are on page 1of 59

Database

Database
A Database is a concept of file organization, it consists of related files stored together so that groups of data items can be easily accessed or retrieved by those who need them.

Elements
A File is a collection of similar groups of data which fit under one heading. Example- Payroll File of a Company consists of the salary detail of all Employees.

A File may be further divided into more descriptive sub divisions called Records. A Record is a collection of related data items treated as a single unit. Record Type- : 1. A Fixed Length Record 2. A Variable Length Record

Each Individual item of data stored in a record is known as a Field.

Example- In Our Payroll Example- Fields can be of Employee Name, Basic Pay , Etc

Database Components
Entities Attributes Relationships Key

Entities
Entity is the real physical object or an event: the user is interested in keeping track of. Or We Can Say, An Item about which information is stored is called Entity Example- An Employee of a Company.

Attributes
A Attribute is a Property or Characteristic of an entity. Example- An Employee can various attributes like- Employee_ Number, Employee_ Salary, Etc.

Relationships
The associations or the ways that different entities relate to each other is called relationships.

Different Relationships

One To Many Relationship Many To Many Relationship One To One Relationship

One To Many Relationship


A Painter might create many different paintings, but each painting is created by only one painter. Thus a Painter(The One) is related to the Paintings(The Many).

Many To Many Relationships In a University, A Student can take many courses, and each course can be taken by many students. Thus, A Student (The Many) relates to Courses (The Many)

One To One Relationship


Suppose A Company owns three hot dogs stands and each hot dog stand is operated by a single employee. So One-TO-One Relationship exist because each hot dog stand is assigned to ony one employee and each employee is assigned to only one hot dog stand.

Key
The data item for which a computer uses to identify a record in a database system is referred to as Key. Or A Key Is a single attribute or combination of attributes of an entity set that is used to identify one or more instances of the set.

Types of Key :Primary Key Concatenated Key Secondary Key Foreign Key Super Key

Primary Key
Primary Key is used to uniquely identify a record . It is also called identifier. Example- Employee_ Number in Employee File can be Primary Key

Concatenated Key
When more than one data item is used to identify a record it is called Concatenated Key. Example- Both Employee Number and Employee Name Can be used.

Secondary Key
An attribute or combination of attributes used strictly for data retrieval purposes A Secondary Key is used to identify all those records, which have a certain property.

Foreign Key
An attribute or combination of attributes in one table whose values must either match the primary key in another table or be null.

Database System Environment


1. 2. 3. 4. Data Hardware (Processor, Storage) Software (C,C++,COBOL,SQL) Users (Application Programmers,
End Users, DBAs, Database Designers)

Data Administrator (DA)


A Data Administrator (DA) is an identified individual person in the organization who has central responsibility of controlling data.

Database Administrator (DBA)


A Database Administrator (DBA) is an individual person or group of person with an overview of one or more database who controls the design and the use of the databases.

Advantages Of DBMS
1. 2. 3. 4. 5. 6. Minimal Data Redundancy. Efficient Data Access. Improved Data Consistency. Improved Data Integrity. Improved Security. Enforcement of Standards.

Disadvantages of DBMS
1. Requirement of new and specialized manpower. 2. Additional Hardware Cost (Initially)

Database Language
1. 2. 3. 4. 5. Data Definition Language (DDL) Storage Definition Language (SDL) View Definition Language (VDL) Data Manipulation Language (DML) Fourth Generation Language (4GL)

Data Definition Language (DDL)

Data Definition Language is a special language used to specify a database design using set of definitions. It supports the definition or declaration of database objects.

Storage Definition Language (SDL) In Storage Definition Language, the storage structure and access methods used by the database system is specified by set of statement. These Statements define the implementation details of Database.

View Definition Language (VDL) VDL refers to the Users View of the database. Generally Two Types:1. Logical View- Programmers Perception 2. Physical View- Data is actually stored on Storage devices

Data Manipulation Language (DML) Data Manipulation Language is a mechanism that provides a set of operations to support the basic data changes on the data held in the database

Data Manipulation Language - Operations Retrieve data from data files Add Records to data files Delete Records from data files Rewrite records in the data files Modify records in the data files

Fourth Generation Language (4GL) The Fourth Generation Language is a compact, efficient and non-procedural programming language that is used to improve the productivity of DBMS In 4GL User Defines What is to be done ?

Database Models A Model is an abstraction process that concentrates on essentials and inherent aspects of the organization applications while ignores accidental details. It is a representation of real world objects and events and their associations.

Types of Database Models :Hierarchical Data Model Network Data Model Relational Data Model Entity Relationship Data Model Object Oriented Data Model

Hierarchical Data Model Hierarchical Data Model resembles an Upside Down tree with the root at the top and the branches formed below. Like A Company Has President who has many Vice-Presidents , Subordinates ,Etc Based On Parent - Child relationship where Each Parent has numerous children but Each Child has only one parent.

Hierarchical Data Model - Features 1. Its basic concepts from the basis for subsequent database development. 2. Its Limitations lead to a different way of looking at database design.

Hierarchical Data Model - Advantages 1. Simplicity 2. Data Sharing 3. Data Security 4. Data Independence 5. Data Integrity 6. Efficiency

Hierarchical Data Model - Disadvantages 1. Implementation Complexity 2. Inflexibility 3. Data Management Problems 4. No Standards 5. Extensive Programming Efforts

Network Data Model - Reasons For Creation 1. To address the need to represent complex data relationships more effectively than the Hierarchical Model. 2. To improve database performance. 3. To impose database standard.

Network Data Model The Network Data Model is similar to Hierarchical Model Except that a Child can have multiple parents. In Network Model Relationship is called Set. Each Set has two record components-: 1. Owner record equivalent to Parent 2. Member record equivalent to Child

Network Data Model - Advantages 1. 2. 3. 4. 5. Simple Design Facilitating more relationships Superior Data Access Database standards Data Independence

Network Data Model - Disadvantages 1. System Complexity 2. Not User Friendly

Relational Data Model E.F. Codd of IBM Research introduced this model in a paper in 1970 The Relational Data Model simplified the users view of the database by using simple tables instead of more complex tree and network structures. So basically it is a collection of tables

Relational Data Model- Terms Used 1. 2. 3. 4. 5. 6. 7. Entities Attributes Relation Tuple Domain Degree Cardinality

Relational Data Model- Terms Used Tuple Row of a relation is referred to as tuple. Domain- The values of an attributes or a column are drawn from a set of values known as domain.

Relational Data Model- Terms Used Degree- A relationships degree indicates the number of associated entities or participants. Cardinality- It expresses the specific number of entity occurrences associated with one occurrence of the related entity.

Relational Data Model- Advantages 1. 2. 3. 4. Simplicity Structural Independence Ease of design, implementation & use Flexible & powerful query capability

Relational Data Model- Disadvantages 1. Hardware Overheads

Entity- Relationship (E-R) Data Model An Entity-Relationship Model is a logical database model or the Conceptual database model as viewed by the End User It was introduced by Mr. Chen in 1976

(E-R) Data Model Main Components -: Entities Attributes Relationships

(E-R) Data Model Building Blocks-: Entities are represented by Rectangle Attributes are represented by Eclipse or Oval Boxes Relationships are represented by Diamond

(E-R) Data Model Advantages 1.Straightforward relational representation 2.Easy conversion for E-R to other models 3.Graphical representation for better understanding.

(E-R) Data Model Disadvantages 1. No Industry standards 2. Popular for high level design

Object Oriented Data Model Objected Oriented data model is a logical data model It represent both an Entity and a Class. A Class represents both Object attributes as well as the behavior of the Entity It is basically a procedural language

Object Oriented Data Model Example- A Customer Class will have not only the customer attributes like Customer- Name, Customer -Address, Etc But also imitate actions such as Update-order, etc

Object Oriented Data Model - Advantages 1. Capable of handling a large variety of data type 2. Combining Object Oriented Programming with database technology 3. Improved productivity 4. Improved data access

Object Oriented Data Model - Disadvantages 1. No Precise definition 2. Difficult to maintain 3. Not Suited for all applications

The Relational Algebra -:

Relational Algebra defines the theoretical way of manipulating table contents using various relational functions.

The Relational Algebra 1. 2. 3. 4. 5. 6. 7. 8. Union Intersection Differences Cartesian Product Select Project Divide Join

Thanks

You might also like