In this lesson, you will learn to: Define a Database Management System DBMS Identify the different DBMS users Describe the need for a database system Define the architecture of a DBMS in
Trang 1In this lesson, you will learn to:
Define a Database Management System (DBMS)
Identify the different DBMS users
Describe the need for a database system
Define the architecture of a DBMS in terms of:
x External level
x Conceptual level
x Internal level
Identify the functional components of a DBMS
Identify the need for database planning
Identify the stages in the Database Development Life Cycle (DDLC)
Identify the effects of poor database planning and design
Trang 2Introduction to Relational Database Management System Lesson 1 / Slide 1 of 12
©NIIT
Introduction to Relational Database
Management System
Objectives
In this section, you will learn to:
• Define a Database Management System (DBMS)
• Identify the components of a DBMS
• Describe the need for a database system
• Define the architecture of a DBMS in terms of:
• External level
• Conceptual level
• Internal level
• Identify the functional components of a DBMS
• Identify the need for database planning
• Identify the stages in the Database Development Life Cycle (DDLC)
• Identify the effects of poor database planning and design
Lesson Overview
The lesson introduces the concept of a database management system (DBMS) and the various users of a DBMS This lesson also covers the benefits, components, and
architecture of a DBMS In addition, this lesson explains the need for database
planning and design and the stages in the database development life cycle
Trang 3• A database is a collection of records.
• Database management systems are designed to maintain large volumes of data.
• The main objectives of any DBMS are to:
• Provide an efficient and convenient environment that is used
to store data in and retrieve data from a database.
• Manage information about users who interact with the DBMS and the activities that these users can perform on the data.
A database is a collection of records One of the major tasks in a computer system is
to store and manage data To handle this task, you need a specialized computer software known as a Database Management System (DBMS) Database management systems are designed to maintain large volumes of data Management of data involves:
Defining structures for data storage
Providing mechanisms for data manipulation
Providing data security against unauthorized access
Database management systems are now available on a wide range of computers, from desktops to mainframes The size and power of the computer determine the system facilities, such as security and storage
Trang 4A single-user system allows only one person to access a database at any given time
In a multi-user system, several users can access a database simultaneously
With the increasing power of desktop computers, multi-user database systems are now available that support a small group of users to connect to these desktop
computers and access data concurrently These database systems can be scaled up to support hundreds or thousands of users, depending on the configuration of the
hardware on which the database system is running
The main objectives of any DBMS are to:
Provide an efficient and convenient environment that is used to store data in, and retrieve data from a database
Manage information about users who interact with the DBMS and the activities that these users can perform on the data
• There are three types of DBMS users:
• Application Programmers: Application programmers write application programs that help an end user to use the database.
• End Users: End users interact with a DBMS either by invoking
an application program or by writing queries in a database query language.
• Database Administrators (DBAs): Database Administrators (DBAs) coordinate the function of collecting information about the data to be stored, and designing and maintaining the database and its security
Trang 5A DBMS user can perform the following activities on a database:
Add files to the database
Insert data in the existing files
Retrieve data from the files
Update data in the files
Delete data from the files
Remove the existing files from the database
Enforce security and integrity rules
There are three types of DBMS users:
The Application Programmer
The End User
The Database Administrator (DBA)
The Application programmers write application programs that help an end user to use the database These programs are usually written in languages, such as C, C++, Visual Basic and Visual C++ The programs process data in the database to retrieve, insert, delete, or modify data
End users interact with a DBMS either by invoking an application program or by writing queries in a database query language The database query language allows the end user to perform basic operations, such as retrieving, deleting, inserting, and updating data
Database Administrators (DBA) coordinate the function of collecting information about the data to be stored, and designing and maintaining the database and its security The database must be designed and maintained to provide the right information to the authorized people
Trang 6I NSTRUCTOR N OTES
Introduction to Database Management System
You can give the following additional information about databases:
A database is a collection of information organized in such a way that a computer program can quickly select the desired data You can think of a database as an
electronic filing system
Traditional databases are organized by fields, records, and files A field is a single unit
of information; a record is one complete set of fields; and a file is a collection of
records For example, a telephone book is analogous to a file It contains a list of records, each of which consists of three fields: name, address, and telephone number Before you list the activities that a user can perform on a database, ask the students what according to them are these possible activities This will make the session
interactive and force the students to think
Trang 7• Standards are enforced
• Security restrictions are applied
• Integrity is maintained
Before the advent of database management systems, the conventional approach to data processing was followed In the conventional approach, a program (or a set of programs) is developed for each application This results in one or more data files for each application Some of the data may be common between files However, one application may require the file to be arranged on a particular field, while another application may require the file to be arranged on another field A major drawback of the conventional method is that the storage and access techniques are built into the programs Therefore, though the same data may be required by two applications, the data is stored in two different places because each application requires different data storage
Trang 8For example, consider the scenario of a university
Association Between Application and Data Files
A university typically needs to record certain data about its courses, the students who take the courses, the semesters when the courses are offered, and the instructors who teach the courses Therefore, the university needs to record data for COURSE,
STUDENT, INSTRUCTOR, and SEMESTER The course scheduling application requires data from the course data file and the student data file The student admission
application requires data from the student data file For the course scheduling
application, the data in the student data file is arranged according to the course code selected by the student In the student admission application, the data in the student file is arranged on the date of registration of the student Therefore, though the same data file was required by multiple applications, it had to be duplicated and stored at multiple locations so that each application could access the file
The conventional approach to database processing has the following drawbacks:
Duplication of Data: The course data file contains information about various courses The information includes course code, course name, course description etc This information is required by the instructors’ schedules application and the semester planning application In other words, the same data is required by multiple applications But instead of storing this information in one file, separate files are used by different applications This repetition of data is referred to as data redundancy
Trang 9Inconsistent Data: Because the same data is stored in different places,
inconsistency creeps in For example, the student admission application adds ten students to the student data file The data of these ten students have to be updated in the student data file used by the course scheduling application If this change is not made in all files, the university will have inconsistent data in different files
Benefits of the Database Approach
Database Approach
A major advantage that the database approach has over the conventional approach is that a database management system provides centralized control of data
Following are some of the benefits of the database approach:
Redundancy is reduced: In the database approach, applications do not have to maintain their own data files The same course data file is used by the course scheduling application, the instructor scheduling application, and the semester planning application
Inconsistency is avoided: Because redundancy is reduced, inconsistency is also avoided Consider a situation where ten students have enrolled for a course This information is stored in the student data file The other applications will use the same student file and therefore, no inconsistency can occur If this
information is recorded in more than one place, inconsistency can occur, as changes made in one data file may not get reflected in another data file
Trang 10Data is shared: While the existing applications can share data in the database, new applications can also be developed that will use the same database
Standards are enforced: With centralized control of data, the DBA can ensure that standards are maintained in stored data formats This is particularly useful for data interchange, or migration of data between two systems
Security restrictions are applied: The DBA ensures that only authorized persons have access to the database The DBA defines the security checks to be carried out Different checks can be applied to different operations on the same data For instance, a person may have access to query a file, but may not have the right to delete or update that file
Integrity is maintained: Inconsistency between two entries can lead to integrity problems Even without redundancy, the database can still be inconsistent For example, a student enrolls in 10 courses when the maximum number of courses
a student can enroll in is seven Or, a student enrolls in a course that is not
being offered in that semester Such problems can be avoided in a DBMS by establishing certain integrity checks that are performed with any update
operation
Why use a Database Management System?
First, ask the students the following question to make them think about the
conventional approach of data processing
What according to you are the features of the conventional approach of data
processing? Can you give some examples?
Then, explain the conventional approach and its disadvantages
Trang 11• There are two levels of mapping involved in this architecture One
is between the external and the conceptual levels, while the other
is between the conceptual and the internal levels
The architecture of a database management system can be broadly divided into three levels:
External level
Conceptual level
Internal level
Trang 12Three Levels of a Database Management System
The External Level
This is the highest level, one that is closest to the user It is also called the user view.
The user view is different from the way data is stored in the database This view
describes only a part of the actual database Because each user is not concerned with the entire database, only the part that is relevant to the user is visible For example, end users and application programmers get different external views
For example, an instructor will view the database as a collection of students and
courses offered by the university An administrator will view the database as a
collection of records on the stock of course material provided by the university The instructor is concerned with only a portion of database that is relevant to the
instructor and the administrator is concerned with only the portion of database that is relevant to the administrator These portions of the database, which are viewed, by the instructor and administrator are referred as their user’s view or external view Each user uses a language to carry out database operations The application
programmer uses either a conventional third-generation language, such as COBOL or
C, or a fourth-generation language specific to the DBMS, such as Visual FoxPro or MS Access
The end user uses a query language to access data from the database
A query language is a combination of three subordinate languages:
Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Control Language (DCL)
Trang 13The data definition language defines and declares the database objects, while the data manipulation language performs operations on these objects The data control language is used to control the user's access to database objects
The Conceptual Level
This level comes between the external and the internal levels The conceptual level
represents the entire database as a whole, and is used by the DBA This level is the view of the data “as it really is” The users’ view of the data is constrained by the language that they are using At the conceptual level, the data is viewed without any
of these constraints
The conceptual level describes what data is stored in the database and what relationships exist between this data
The Internal Level
This level deals with the physical storage of data, and is the lowest level of the architecture The internal level describes the physical sequence of the stored records Following is an example of the three levels:
External
cout << “Emp#” << EMPLOYEE_CODE;
cout << “ Dept#” << DEPARTMENT_CODE;
cout << “Salary” << SALARY;
STORED EMPLOYEE LENGTH=18
PREFIX TYPE=BYTE(6), OFFSET=0
EMP# TYPE=BYTE(6), OFFSET=6, INDEX EMPX
DEPT# TYPE=BYTE(4), OFFSET=12
SALARY= BYTE(4), OFFSET=16
Mappings
Mapping determines the correspondence between one level and another There are two levels of mapping involved in this architecture One is between the external and
Trang 14the conceptual levels, while the other is between the conceptual and the internal
levels The external-conceptual mapping determines the correspondence between the conceptual and the user views This specifies how a user views the conceptual data The conceptual-internal mapping determines the correspondence between the
conceptual and internal views It specifies how the conceptual data is stored
The first step in designing a database is to define the conceptual level The conceptual level is then mapped to the external level Each user view and the requirement is
taken into consideration Next, the conceptual-internal mapping is done The way data
is stored is derived from the conceptual level This three-level architecture of a DBMS helps achieve data independence
Architecture of a Database Management System
You can give the following additional information about the external level:
The external view is defined by means of the external schema The external schema is
a definition of the various types of records in that external view The external schema
is written using DDL statements
You can ask the following questions to test the students on the concepts covered in this topic
1 Which portion of the database is visible to the user?
2 Which three subordinate languages constitute the query language?
3 The physical storage of data is described at which level?
Solutions
1 External view
2 DDL, DML, and DCL
3 Internal level