0% found this document useful (0 votes)
88 views

Module-II: Database and Database Management System

The document discusses the differences between files and relational databases. It notes that files store data in one-dimensional files and leave data relationships to applications, while relational databases store data in two-dimensional tables and establish relationships within the database. The document also provides objectives and advantages of using a database approach.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

Module-II: Database and Database Management System

The document discusses the differences between files and relational databases. It notes that files store data in one-dimensional files and leave data relationships to applications, while relational databases store data in two-dimensional tables and establish relationships within the database. The document also provides objectives and advantages of using a database approach.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 75

Module-II

Database and database management system

Difference between files and Relational database Files 1. Store data in one dimensional files 2. Stores, organize and retrieve information from one file at a time 3. Leave the management of data relationships to the applications that access the data.
Relational database 1. Store data in two dimensional tables 2. Store organizes and retrieve information is linked by a common column or field 3. Establish relationships between files and views within the database itself.

4. Require a

programmer to write code for data management functions. 5. Files are created and maintained by application programs. 6. Are often associated with older programs on mainframe and mid-range system.

4. Are typically created


and maintained by database administrators. 5. Are popular on UNIX processors and powerful server within a client/server framework 6. Consists a database engine that performs different functions.

Database
Database is an integrated and well defined data and information,centrally controlled in all its aspects,created and stored in atypical structure for an organization. In an organization the database could be one or more depending upon the needs and the operations of the organization. The data structure and its storage should be such that it facilitates sharability,availability,and integrity of data. Database excludes transient data such as reports,input documents,intermediate results obtained during processing

Objectives of Database
1. 2. 3. 4. 5. 6. 7. 8.
Controlled Redundancy Ease of learning and use Data independence More information at low cost Accuracy and integrity Recovery from failure Privacy and security Performance

Advantages of Database Approach

All the three levels of management use the same database hence any report using the information will be consistent All the three levels of management view the database as per their needs. The application systems can be developed independent of the database. The data validation and updating will be once and same for all The data is shared by all user Data security and privacy can be managed AS the database is a storage of structured information the queries can be answered fast.

User programs Application program or queries Software to process Queries/Programs S/W to access Stored Data

Stores database definition

Stored data base

Major types of databases used by Organization and users


Computer using organizations have five types of databases. Common operational database Common end user database Distributed database Personal and end user databases and External database

1. 2. 3. 4. 5.

Personal and end user databases


These databases consists of a variety of data files developed by end users at their workstations.Users may have their own electronic copies of documents they generated with word processing packages or received by e-mails, from electronic spreadsheets and DBMS packages.

Distributed database
These are databases of local work groups and departments at regional office,branch offices manufacturing plant and other work sites.These database can include segments of both common operational and common user databases as well as data generated and used only at a users own site.

Common operational database


These databases store detailed data needed to support the operation of entire organization.They also called subject area databases,transaction databases and production databases. For example Customer database,personnel database,accounting database

Common end user database


These databases store data and information extracted from selected operational and external databases.they consists of summarized data and information most needed by the organisation managers and other end users.They are also called information databases and management databases and accessed by executive and users as part of DSS And EIS to support managerial decision making.

External databases
These can be accessed from large,privately owned databases or databanks available for a fee to end users and organisations from commercial information service networks.Data is available in the form of statistics on economic and demographic activity from statistical data banks; abstracts from hundreds of newspapers,magazines and other periodicals from bibliographic data banks.

Data base management system


DBMS is a collection of programs that enables users to create and maintain a database.The DBMS is a general purpose software system that facilitates the processes of defining,constructing and manipulating databases for various applications. Defining database involves specifying the data type structures and constraints for the data to be stored in the database. Constructing the database is the processes of storing the database itself on the storage medium that is controlled by DBMS. Manipulating includes the updating of database or editing the database and generating reports from the data. The DBMS is a S/W or a set of rules and methods that allows for defining,creating,updating,reading ,maintenance and protection of the database.

DBMS
DBMS consists of a collection of inter-related data and a set of programs to access that data.The collection data is usually referred to as database which contains information about one particular enterprise. The primary goal of a DBMS is to provide an environment that is both convenient and efficient to use retrieving and storing database information. DBMS is the interface between the user of application programs on one hand and the database on other.

DBMS
DBMS as interface between application program and data base
User(or) Application program DBMS

Data base

Major users of a DBMS package


Database integration and reporting Application development Database access and maintenance Database creation and modification

Components to a DBMS These are:1. At least one person who owns' and is responsible for the database. 2. A set of rules and relationships that defines and governs the interactions among elements of the database. 3. People who put data into the database 4. People who get data out of the database 5. The database itself.

Components of DBMS
DDL DML SQL

Functions of DBMS
1.
2.
Organizes data:-Data are organised according to the specifications of DDL.These are specified by the DBA at the time of creation of database. Integrates data:- Data are interrelated or linked together at the elements level and can,therefore be assembled in many combinations during execution of a particular application program. Separates data:-A DBMS servers as a filter between application program and their associated data.It separates the logical description and relationship of data from the way in which the data are physically stored. Controls data: A DBMS appears to an application programmer to be an extension of the O.S S/W .As it receives data requests from host programs,it controls how and where data are physically stored. Retrieves data:A record of data can be obtained via DBMS1.Serially 2.Sequentially 3.Randomly by address 4.Randomly by key 5. By structural link Protects : A DBMS protects and secures both the content of a database and relationships of data element . Data are protected against by unauthorized users,physical damage,OS

3.

4.

5.
6.

1. It is an encyclopedia of information concerning each

Data dictionary

data element.It describes the data and its characteristics,such as location,size,type of data,it identifies the origin,the use,the ownership,and the method of accessing and securing data. 2. The data dictionary can exist either on paper or as a computer file.When it exist as a file,special S/W is necessary to create and maintain it,and make it available for use such S/w is called a data dictionary system(DDS).DDSs can be acquired as separate S/W packages or as DBMSs and computer aided S/W engineering tools. 3. A good data dictionary would ensure consistent definitions of data across different databases,and if there were a change to the data ,it would also

Benefits of database management system


Reduced programming cost Reduced Development and implementation time Reduced program and file management costs. Reduced data redundancy Increased flexibility

Language
Two languages are used to communicate with data base are: 1. Data description Language(DDL) 2. Data manipulation Language(DML)

Data description Language(DDL)


It is used to create and describe the data and define the schema in a DBMS It serves as an interface for application programs that use the data.Once the data dictionary has been created its definition must b entered into the DBMS. For example,if a payroll program needs the employment number of an employee the DDL defines the employment number and the other data in the database and acts as an interface between the payroll program and the files that contain the employment number

Data manipulation language A language that processes and manipulates the data in the database is called data manipulation language. It allows the user to query the database and receive summary reports and/or customised reports. DML enables the user to access,update,replace,delete and protect database records from unauthorised access. The DML is usually integrated with other PLs,many of which are 4Gls,to implement sophisticated database functions.

Structured Query Language


It is a non procedural language exclusively deals with data: Data integrity Data manipulation Data access Data retrieval Data query Data security

SQL
It allows the user to access the data from the databases to specific queries,both on mainframes and on PCs.Here users can transform their experience from one database system to another without going into much detail. There are four basic operation in SQL Select Update Insert And delete

1. 2. 3. 4.

SQL
Select statement enables users to query the database for specific information Update statement allow users to update the data. Insert statement new data in the existing database. Delete statement delete existing data from the database Two types of question s can be asked by users in SQL: -Static Question & dynamic Question Static questions are routine and standardize and once defined,can be used repeatedly or generating weekly,monthly and quarterly reports, S/W packages generating static questions are sometimes referred to as report writers. Dynamic questions are ad hoc and specific to the decision maker.

Characteristics of DBMS
The capability to store large amounts of data necessary for users needs.They are stored on direct accessible devices for on-line support. The capacity to interrogating data files,retrieving and modifying data and recording the changes The data are combined to form operational units to minimise the duplication of data and increase access to all data in the database. The control in the systems limits the access to the database files and builds the confidentiality of all data in these files.

Objectives of DBMS
Provide for mass storage of relevant data. Make access to the data easy for the user Provide prompt response to user requests for data. Make the latest modifications to the data base available immediately Eliminate redundant Data Allow for multiple users to be active at one time Allow for growth in the database system Protect the data from physical harm and unauthorised access

Major uses of DBMS


1.
The four major uses of a DBMS package are: Database interrogation and reporting(for end users) Application development(for end users and programmers) Database access(for end users and information service staff) Database creation and modification(for end users and database administrators)

2.
3. 4.

Data Independence
The ability to modify a schema definition in one level without affecting a schema definition in the next higher level is called data independence. There are two levels of data independence Physical data independence Logical data Independence

Physical data independence


It is the ability to modify the physical schema without causing application programs to be rewritten.Modifications at the physical level occasionally necessary in order to improve performance.

Logical data Independence


It is the ability to modify the conceptual schema without causing application programs to be rewritten.Modification at the conceptual level are necessary whenever the logical structure of the database is altered(addition of money-market accounts in banking system).It is more difficult to achieve than physical data independence since application programs are heavily dependent on the logical structure of the data they access.The concept of DI is similar in many respects to the concept of abstract data types in modern PLs . Both hide implementation details from the users.This allows users to concentrate on the general structure rather than low level implementations details.

Data base Basic


Data items:-It is the smallest unit of data that has meaning to its user .The data item is simply known as the field in data processing.It may be treated as a molecule of the database.For example a student name in a database is called as a data item.The data item could occasionally be further broken down is called atomic level for processing purposes.For example,a data item such as a data would be a composite value comprising the date,day and year.For example your registration number etc. In the organisation ,each department is responsible to find out its own way of

Entities
All the real world object such as an employee, a component in an inventory or a space or it may be intangible such as a even,a job description,identification numbers.All such items about which relevant information is stored in the database are called Entities.

Attributes
An attribute may be expressed as a number or as a text.It may even be a scanned picture,a sound sequence,a moving picture which is now possible in multimedia database Data processing normally concern with a collection of similar entities and records information about the same attributes of each of them

Schema
A schema is a logical database description and is drawn as a chart of the types of data that are used .It gives the names of the entities and attributes and specify the relationship between them.It is a frame work into which the data item can be fitted.Like an information display system such as that giving the arrival and departure time at airport and railway stations,the schema will remain the same though the value displayed in the system will change from time to time.The relationship between the entities occurring in the schema may be one-to-one or one-to-many or many to many or conditional.That means it is an overall chart of all the data item type and record types

Subschema
The term subschema refers to the same view but for the data-item types and record type which are used in a particular user.Therefore many different sub-schemas can be derived from one schema

Analysis between schema and sub schema


If schema represent a road map of Delhi showing the major historical sites ,educational institutions,railway stations,roadway stations and airports,a subschema could be a similar map showing one route each from the railway station or the airport to IGNOU campus at Maidan Garhi

A general model of a database system


External schema

User view

User view

User view

Conceptual Schema Internal Schema Stored data

Three views of data


DBMS is a collection of interrelated files and a set of programs that allows several users to access and modify these files. The concern for efficiently leads to the design of complex data structure for the representation of data in the data base.As the database system are often used by non computer professionals,this complexity must be hidden from database system users. This is done by defining levels of abstract as which the database may be viewed,there are three views. 1. Logical or External view 2. Conceptual view 3. Internal or Physical view

External view or logical view


It is the highest level of abstraction as seen by a user This level of abstraction describes only the part of entire database.

Conceptual view
This is the next higher level of abstraction which is the sum total of users views.This level describes what data are actually stored in database. This level contains information about entire database in terms of a small number of relatively simple structure. It represents the entities and there relationships. It contains integrity rules and authorization rules,but it does not contain information about how the data items are stored

Internal View
This is the lowest level of abstraction at which one describes how the data are physically stored And how we can access it. It includes information on ordering of records,block sizes,storage indexes,use of pointers,and access strategies being used.

Data Base Administrator


A person who is having central control over the data and the programs. Functions of DBA 1. Schema definition, 2. Storage structure and access method definition, 3. Schema physical organisation for data access, 4. Integrity constraint specification. 5. Back up and restore database 6. Monitor database performance and efficiency.

File management vs. database management


Topic Data redundancy File Management May have high degree of data redundancy Recognition of record format or access method means the application has to be changed Database management Has a low degree of data redundancy Similar recognition has little or no impact on application

Data Independence

Application Maintenance

Higher Low maintenance maintenance cost cost Provided by DBMS A query language can be used

Integrity controls Usually provided by programmer Unanticipated Queries A custom program has to

Cont.
Data relationship Handled by applications if at all Little CPU and Storage overhead An integral part of DBMS

Overhead

Database ownership

Applications may have their own private data

More processing power and storage is needed All data belongs to the DBMS

cont
Database design Data files may be designed as needed Not needed More time and effort is spent to develop a good database design to Needed coordinate and resolve the needs of the user community The average programmer needs to be trained to use database management

DBA

Availability of trained programmers

Most programmers are trained to use file management

Data models
A data model is a collection of concepts that can be used to describe the structure of a database.By structure of a database we mean the data types,relationships and constraints that should hold on data. Most of the data models also include a set of basic operations for specifying retrievals and updates on the database. A database model is the method of organizing data and represents the logical relationship among data elements in database .

Data Models
Data model is of three types 1. Object based logical model:ER model,Object oriented model,binary model,Semantic data model,info logical model,functional data model 2. Records based logical models:Relational,Network,Hierarchic al 3. Physical data model:Unifying

Types of data model

Hierarchical Model Net work Model Relational model

Types of Relationship
One-to-one:This relationship indicates a unique relation between two entities(studentregd-no,person and employment no.) One-to-many:Here an entity can have multiple relationships with other entities in the database(Air bus and passengers,teacher and student) Many-to-many:Here every entity can be related to a number of entities.(teachers and students).

of database processing system in banking

Chequing Application

Saving Application

Installment loan Application


Installment loan data model

Chequing and Savings data model

Banking Service data model Operating System Application Program DBMS

Bank database

Hierarchical Model
It helps to establish explicit or logical relationships among various data elements of multiple files and arrange the elements in a hierarchy. Each box is a record,it is also termed as node. In this model each record in one level can be related to multiple records on the next-lower level. A record that has a subsidiary records is callec the parent and the subsidiary records are called children. It follows 1:M relationship with other data elements in the database

Schematic of a hierarchical tree structure Entity type Record type

Entity type

The above figure provides the hierarchical model Here link fields establish the explicit relation ships. The links are represented by thin lines that connect data elements of the various records in the lower portion. Once a sales person record is retrieved the link in that record can lead to another record i,e logically related to that salesperson.A link field in the second record leads to a 3rd record,and so on creating a chain through an entire set of file. The system retrieve records from the hierarchy through pointers,which are pieces of data that identifies the link between different records.The data nodes in this are linked to one another through a series of pointers,one of which is attached to the end of each record in the database

Advantage
Well suited for modeling hierarchical data. Top-down nature makes programming efficient.

Disadvantage
Based on one-way access from superiors to subordinates. Not suited for manyto-many relationships. Difficult to inert subordinate records without superior records. Deleting superiors logically deletes subordinates. Difficult to update record stored in multiple locations. Not suited for databases where relationships change.

Network Model
In this model,each record in a database can have multiple parents. It maintain Many-to-Many(M:M) relationship In network model,databases can be translated from hierarchical form to network form and vice-versa. Data elements are linked through pointers. In this model a child can have a number of parents,where as in a hierarchical model a child can have only one parent. Like hierarchical model the records are not limited to only one superior. A record may have many superior records and many subordinate records.

Network Model
It allows entry into a database at multipoint A group of interconnected nodes is called a network. A subway map is an example of a network.The subway stations are the nodes,and the tracks are the interconnections or network. A common approach is multi pointers,especially with a link node record representing the connection between two entities.

Advantages
It promotes flexibility and data accessibility,since data elements at a lower level can be accessed without accessing the data elements above them. It is efficient ,easy to understand,and can be applied to many real world problems that require routine transaction.

Disadvantages
It is complex to design and develop It requires that the relationships among all data elements to be defined before development starts,and changes often demand a major programming efforts For large database ,operation and maintenance of the network model are time-consuming and expensive

Relational Model
In relational model , data is represented using two-dimensional tables,called relation of flat files The flat files are made up of columns and rows. Each column represents a field,also referred to as an attribute. Each row represent a record , also referred as a tuple. It is well suited for business needs because of their flexibility

Relational Model
Relational databases use three fundamental operations: SELECT PROJECT JOIN The select operation is used to selected the requested query. The project operation creates a subset of columns designed to meet the information needs of the user. The JOIN operation joins or links two or more tables ,if the information requested by the user is not found in one table Example:MS Access,dbase IV,DB2

Advantages
Query languages allow ease of use. It can relate data in a table as long as the two tables share at least one common attribute.Thats why most commercial databases for microcomputers use relational database It enables a computer system to accommodate a variety of file inquiries in an efficient manner. No need to know the inner structure of the database Data independence allow easy structure modification

Disadvantages
Query languages consume processing time and memory Data must be related to act upon Set processing is not suite3d to conventional PLs. Command affect system performance

Relational Database
A DBMS can be regarded as relational only if it obeys the following three rules. 1. All information must be held in tables 2. Retrieval of this data must be possible using the following types of operation Select, Join,Project 3. A relationship between data must be represented explicitly in that data itself.

Aims of Relational Database


1. Performance 2. The ability to distribute data. 3. The ability to handle enormous
quantity of data

Distributed Processing
It refers to an architecture in which a database resides on a different machine to the user process accessing it. To put this in a different way,the front and back end processes are on different machines.Such a machine will obviously necessitate some form of communication capability between the machine and depends entirely on a complex logical and physical separation between the front and back end processes and processing

Distributed database
A distributed data system is a collection of sites or connected by communication lines whereby: 1. Each participating node houses a relational database 2. These databases are themselves fully functional within their own location. 3. A logical global distributed database is defined incorporating elements of each of the participating databases in order to evaluate a single occurrence of a database.

Normalisation
It is the processes of simplifying the relationship between data elements in a record.Through normalization, a collection of data in a record structure is replaced by successive record structures that are simpler and more predictable and therefore more manageable.The reasons why it is carried out are: To structure the data to maintain the data an its relationship. To permit simple retrieval of data in response to query and report requests. To simplify the maintenance of the data through updated inventories and deletions. To reduce the need to restructure or reorganize data when application requirements arise.

1.
2.

3.
4.

Degree of Normalisation
1NF(First Normal Form) 2NF(Second Normal Form) 3NF(Third Normal Form) BCN(Boyce-codd Normal Form) 4NF(Fourth Normal Form) 5NF(Fifth or Projection-Join Normal Form)

1NF(First Normal Form)


This is the lowest level of normalization.A relation is said to be in 1NF if there will be no composite attributes,and every attributes is single and describes one property.

2NF(Second Normal Form)


A relation is said to be in 2NF if it is in 1NF and non-key attributes are functionally dependent on the key attribute(S).Further,if the key has more than one attribute then no non key attributes should be functionally dependent upon a part of the key attributes. An attribute is a non-key if it is not part of the primary key. An attribute is functionally dependent on a key if the attribute contains only one value which depends on that key .For eg:the attribute SALARY contains only one value which depends on the key NAME.

3NF(Third Normal Form)


Data is in 3NF if and only if it is in 2NF and every non-key attribute is non-transitively dependent on the primary key.A 3NF will be needed where all attributes in a relation tuple are not functionally dependent ,then there will be unnecessary duplication of data.The purpose of 3NF is to ensure that attributes directly belong to the entity. Transitivity is a mathematical principle that states If a relation is true between the first value and the second,and between the second and the third, then the relationship must also be true between the first and the third. Examples If A<B and b<C,then A<C If A>B and B>C,then A>C If A=B and B=C,then A=C

Boyce-cod Normal form


When a relation has more than one possible key and the composite keys have a common attribute and if an attribute of a composite key is dependent on an attribute of the other composite key,a BCNF is need.For example Professor(professor code,Dept,HOD,Percent time It is assumed that A professor can work in more than one department The percentage of time he spends in each department is given Each department has only one HOD

Fourth and Fifth Normal form


When attributes in a relation have multivalued dependency, further normalization to 4NF and 5NF are required

You might also like