Introduction to database system What is a Database system? What is a Database system? Data System...

24
Introduction to database system What is a Database system? What is a Database system? Data System Components Data System Components Data Data Hardware Hardware Software Software User User What is Database What is Database Benefits of Database Approach Benefits of Database Approach

Transcript of Introduction to database system What is a Database system? What is a Database system? Data System...

Page 1: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Introduction to database system

What is a Database system?What is a Database system?

Data System ComponentsData System ComponentsDataData

HardwareHardware

SoftwareSoftware

UserUser

What is DatabaseWhat is Database

Benefits of Database ApproachBenefits of Database Approach

Page 2: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Database System

Database systemDatabase system is a computerized is a computerized record-keeping system. It is a computerize record-keeping system. It is a computerize system whose overall purpose is to store system whose overall purpose is to store information and to allow users to retrieve information and to allow users to retrieve and update that information on demand.and update that information on demand. – Information is anything that is Information is anything that is

significant to the individual or significant to the individual or organization concerned.organization concerned.

Page 3: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Data VS InformationData VS Information

Data is used to refer to what is Data is used to refer to what is actually storedactually stored in the database in the database

Information is used to refer to Information is used to refer to meaningmeaning of that data as of that data as understood by some user.understood by some user.

Page 4: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

OperationsOperations

Adding new file to databaseAdding new file to database Inserting data into existing filesInserting data into existing files Retrieving data from existing filesRetrieving data from existing files Deleting data from existing filesDeleting data from existing files Changing data in existing filesChanging data in existing files Removing existing files from the Removing existing files from the

databasedatabase

Page 5: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Database System Database System ComponentsComponents DataData HardwareHardware SoftwareSoftware UsersUsers

Page 6: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

DataData Database System are available on machines Database System are available on machines

that range from all the way from personal that range from all the way from personal computers to the largest mainframe or computers to the largest mainframe or clusters of mainframesclusters of mainframes. .

In particular, tend to be In particular, tend to be multi-usermulti-user; whereas ; whereas on small machine on small machine tend to be singer usertend to be singer user..

Single User systemSingle User system is a system in which at is a system in which at most one user can access the database at most one user can access the database at any given time.any given time.

Multi user systemMulti user system is a system in which is a system in which many users can access the database at many users can access the database at the same time.the same time.

Page 7: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

The data in database – for large The data in database – for large system- will be both system- will be both integratedintegrated and and sharedshared..

IntegratedIntegrated– Mean the database can be thought of Mean the database can be thought of

as a unification of several district files, as a unification of several district files, with anywith any redundancyredundancy among those among those files partly or wholly eliminatedfiles partly or wholly eliminated

SharedShared– Mean the database can be Mean the database can be shared shared

among different usersamong different users, in the sense , in the sense that different users can have that different users can have access to access to the same datathe same data, possible even at the , possible even at the same timesame time (“ (“Concurrent accessConcurrent access”).”).

Page 8: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

HardwareHardware

The hardware components of the system The hardware components of the system consist of consist of

The secondary storage volumes used The secondary storage volumes used to hold the stored data, together with to hold the stored data, together with the associated I/O devices, device the associated I/O devices, device controllers, and so forth.controllers, and so forth.

The hardware processors and The hardware processors and associated main memory that are associated main memory that are used to supported the execution of used to supported the execution of the database system softwarethe database system software

Page 9: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

SoftwareSoftwareDatabase Management System Database Management System (DBMS)(DBMS)Data Data => physically stored => physically stored

All request for access to the database are All request for access to the database are handle by the DBMShandle by the DBMS

DBMS is thus DBMS is thus shielding of shielding of database users database users from hardware level detailsfrom hardware level details

Provides usersProvides users with a perception of the with a perception of the database that is elevated somewhat above database that is elevated somewhat above the hardware level details.the hardware level details.

Support user operationsSupport user operations

Page 10: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Database Management Database Management SystemSystem DBMSDBMS is a general purpose software is a general purpose software

system that facilitates the process of system that facilitates the process of definition, construction, manipulating, definition, construction, manipulating, and sharing databases among and sharing databases among various users and applications.various users and applications.– Defining a databaseDefining a database involves involves

specifying the data types, structures, specifying the data types, structures, and constrains for the data to be stored and constrains for the data to be stored in the database.in the database.

Page 11: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Manipulating a databaseManipulating a database includes such includes such functions as querying the database to retrieve functions as querying the database to retrieve specific data, updating the database to reflect specific data, updating the database to reflect changes, and generating reports from data.changes, and generating reports from data.

Sharing a databaseSharing a database allows multiple users and allows multiple users and programs to access the database concurrently.programs to access the database concurrently.

Other important functionsOther important functions – ProtectionProtection both system protection against hardware both system protection against hardware

or software malfunction (crash) and Security or software malfunction (crash) and Security protection against unauthorized or malicious access.protection against unauthorized or malicious access.

– DBMS must be able to maintainDBMS must be able to maintain the database the database System by allowing the system to evolve as System by allowing the system to evolve as requirements change over time.requirements change over time.

Page 12: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

UserUser Application ProgrammerApplication Programmer

– Responsible for writing database Responsible for writing database application programs in some application programs in some programming language programming language

End UserEnd User– Access database interactively as just Access database interactively as just

described, A given user can access described, A given user can access the database via online application the database via online application program or user query languageprogram or user query language

Page 13: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Database DesignersDatabase Designers– Responsible for identifying the data to be Responsible for identifying the data to be

stored in the database and for choosing stored in the database and for choosing appropriate structures to represent and store appropriate structures to represent and store in database. in database.

– Undertaken before the database is actually Undertaken before the database is actually implement.implement.

– It is responsibility of database designers to It is responsibility of database designers to communicate with all database user to communicate with all database user to understand their requirements, and to come understand their requirements, and to come up with a design that meets users’ up with a design that meets users’ requirements.requirements.

– Designer may be one of staff of Database Designer may be one of staff of Database Administrator (DBA)Administrator (DBA)

– Interact with each groups of users and develop Interact with each groups of users and develop views views the database that meet the data and the database that meet the data and processing requirements of those groups.processing requirements of those groups.

– Final database designFinal database design must be capable of must be capable of supporting the requirements of all user groups.supporting the requirements of all user groups.

Page 14: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Database AdministratorsDatabase Administrators: : responsible for authorizing responsible for authorizing access to the database, for coordinating and monitoring access to the database, for coordinating and monitoring its use, and for acquiring software and hardware resource its use, and for acquiring software and hardware resource needneed

Defining the conceptual schema (Defining the conceptual schema (Logical/conceptual Logical/conceptual Database DesignDatabase Design))

Defining the internal schema (Defining the internal schema (Physical Database Physical Database designdesign))

Liaising with users, to ensure that data they need is Liaising with users, to ensure that data they need is available and to write or help user to write the available and to write or help user to write the external schemas, using the applicable external DDL.external schemas, using the applicable external DDL.

Defining security and integrity constraintsDefining security and integrity constraints

Defining dump/restore schemesDefining dump/restore schemes

Monitoring performance and responding to changing Monitoring performance and responding to changing requirement.requirement.

Page 15: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Users/Programmers

Application Programs/Queries

Software to Process Quires/Programs

Software to Access Stored

Data

DBMS Software

Stored Stored DatabaseDatabase

Stored Database Stored Database DefinitionDefinition

((Meta DataMeta Data))

DATABASE SYSTEMDATABASE SYSTEM

Page 16: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

What is a databaseWhat is a database

By C.J. DateBy C.J. Date““a Database is a collection of persistent data a Database is a collection of persistent data

that is used by the application systems of that is used by the application systems of some given enterprise”some given enterprise”

Elmasri & NavathaElmasri & Navatha““DatabaseDatabase is a collection of related data. is a collection of related data.

– DataData mean facts that can be recorded and that mean facts that can be recorded and that have implicit meaning.”have implicit meaning.”

– Database can be any size and varying complexityDatabase can be any size and varying complexity– Database may be generated and maintained Database may be generated and maintained

manually or it may be computerized.manually or it may be computerized.

Page 17: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Why DatabaseWhy Database Compactness:Compactness: no need for possible no need for possible

voluminous paper file.voluminous paper file. SpeedSpeed:: Machine can retrieve and update Machine can retrieve and update

data faster than humandata faster than human Less drudgeryLess drudgery:: maintaining files by hand maintaining files by hand

is eliminated.is eliminated. CurrencyCurrency:: Accurate, up-to-date Accurate, up-to-date

information is available on demand at any information is available on demand at any time.time.

ProtectionProtection:: Data can be better protected Data can be better protected against unintentional loss and unlawfulagainst unintentional loss and unlawful

Page 18: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Benefits of Database Benefits of Database ApproachApproach The data can The data can sharedshared RedundancyRedundancy can be reduced/controlled can be reduced/controlled InconsistencyInconsistency can be avoided can be avoided Transaction support can be providedTransaction support can be provided IntegrityIntegrity can be maintained can be maintained Security can be enforcedSecurity can be enforced Conflicting requirements can be balancedConflicting requirements can be balanced Standard can be enforced Standard can be enforced

Page 19: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

Controlling redundancyControlling redundancy– RedundancyRedundancy is storing the same data is storing the same data

multiple times leads to several multiple times leads to several problems.problems.

Duplication effortDuplication effort Storage waste, when same data stored Storage waste, when same data stored

repeatedlyrepeatedly File that represent same data may became File that represent same data may became

inconsistentinconsistent..

– Database approach, the views of Database approach, the views of different user groups are integrated different user groups are integrated during database design. Logical data during database design. Logical data item in only one-place in database, item in only one-place in database, Ensure redundancy, “Ensure redundancy, “controlled controlled redundancyredundancy”.”.

Page 20: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

SecuritySecurity Restricting Unauthorized AccessRestricting Unauthorized Access

– Multiple user share large databaseMultiple user share large database

– most users will not be authorized to access all most users will not be authorized to access all information in the databaseinformation in the database

Example : KKU RegistrationExample : KKU Registrationall database can see by DBAall database can see by DBAStudents can see/manipulate Students can see/manipulate

only only some part of their datasome part of their data

– Type of operation must be controlled

– User/User group are given account number and passwords to access the data base. DBMS provide a security and authorization subsystem, DBA uses them to create account and to specify account restrict.

Page 21: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

ExampleExample Fact(factcode, factname)Fact(factcode, factname) Dept(faccode, deptcode, deptname)Dept(faccode, deptcode, deptname) Student(id, name, address, Student(id, name, address,

factcode,factname)factcode,factname) Subject(subjcode, subjname, credit)Subject(subjcode, subjname, credit) Teacher(tcode,tname,taddress,factcoTeacher(tcode,tname,taddress,factco

de,deptcode,….)de,deptcode,….) Grade(id,subjcode,year,sem,grade)Grade(id,subjcode,year,sem,grade) Etc.Etc.

Page 22: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

IntegrityExample

Create table fact( factcode char(4), factname varchar2(30),

primary key(factcode));

Example 2

Create table dept( factcode char(4), deptcode char(4), deptname varchar2(30),

primary key(factcode,deptcode),foreign key (factcode)references fact(factcode));

Page 23: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

viewview

Create view studGrd as select Create view studGrd as select id,name,subjcode,name,year,sem,gid,name,subjcode,name,year,sem,grade from student,grade rade from student,grade

where stdent.id = grade.idwhere stdent.id = grade.id

Page 24: Introduction to database system What is a Database system? What is a Database system? Data System Components Data System ComponentsDataHardwareSoftwareUser.

SummarySummary

Define a database system and Define a database system and database componentsdatabase components

Database as a collection of Database as a collection of related data, where data means related data, where data means recorded facts.recorded facts.

The benefic of the Database The benefic of the Database systemsystem