+ All Categories
Home > Documents > 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

Date post: 29-Mar-2015
Category:
Upload: itzel-biddison
View: 221 times
Download: 4 times
Share this document with a friend
Popular Tags:
36
06/17/22 06/17/22 1 Database System Database System DICT:501 DICT:501 Md. Ariful Islam Md. Ariful Islam Khandaker Khandaker Assistant Professor, Assistant Professor, IICT. IICT. KUET KUET
Transcript
Page 1: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/2304/10/23 11

Database SystemDatabase SystemDICT:501DICT:501

Md. Ariful Islam KhandakerMd. Ariful Islam Khandaker

Assistant Professor, IICT.Assistant Professor, IICT.

KUETKUET

Page 2: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 2

Outline Outline

► Purpose of Database SystemsPurpose of Database Systems► View of DataView of Data►Data Models Data Models ►Data Definition Language Data Definition Language ►Data Manipulation LanguageData Manipulation Language► Transaction Management Transaction Management ► Storage ManagementStorage Management►Database AdministratorDatabase Administrator►Database UsersDatabase Users►Overall System StructureOverall System Structure

Page 3: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 3

Database DefinitionDatabase Definition

What is Database?What is Database?

A database is basically just a A database is basically just a computerized record-keeping computerized record-keeping system where data are stored in system where data are stored in organized way.organized way.

The database itself can be regarded The database itself can be regarded as a kind of electronic filing as a kind of electronic filing cabinet; i.e., it is like a repository or cabinet; i.e., it is like a repository or a container for a collection of a container for a collection of computerized data files.computerized data files.

Page 4: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 4

Difference between Data Difference between Data and Informationand Information

““Data” refer to what is actually stored in Data” refer to what is actually stored in the database. It is unprocessed value.the database. It is unprocessed value.

““Information” refers to the meaning of Information” refers to the meaning of that data as understood by some user. that data as understood by some user. It is processed data.It is processed data.

Example- Simply 50 is data i,e value but if Example- Simply 50 is data i,e value but if “the mark is 50”- is information.“the mark is 50”- is information.

But in language, the terms “data” and But in language, the terms “data” and “information” are treated as “information” are treated as synonymous.synonymous.

Page 5: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

Database(Back End)Database(Back End)

04/10/23 5

Page 6: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

Database Access through Database Access through formsforms

04/10/23 6

Page 7: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

Fetching Data from DatabaseFetching Data from Database

04/10/23 7

Page 8: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 8

Components of Database Components of Database SystemSystem

A database system involves four major A database system involves four major components:components:

1.1. Data - Integrated form, Shared form.Data - Integrated form, Shared form.

2. Hardware – Processor, Primary & Secondary 2. Hardware – Processor, Primary & Secondary Storage.Storage.

3. Software – Operating Systems, DBMS.3. Software – Operating Systems, DBMS.

4. Users – Basically two types – Administrator, Normal 4. Users – Basically two types – Administrator, Normal UserUser

Page 9: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 9

Operations on Database fileOperations on Database file

Adding new, empty files to the database;Adding new, empty files to the database;

Inserting data into existing files;Inserting data into existing files;

Retrieving data from existing files;Retrieving data from existing files;

Changing data in existing files;Changing data in existing files;

Deleting data from existing files;Deleting data from existing files;

Removing existing files from the Removing existing files from the database.database.

Page 10: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 10

Database System Database System ApplicationsApplications

► BankingBanking:: For customer information, accounts, and loans, and For customer information, accounts, and loans, and banking transactions.banking transactions.

► Airlines:Airlines: For reservations and schedule information. For reservations and schedule information.► Universities:Universities: For student information, course registrations, and For student information, course registrations, and

grades.grades.► Credit card transactions:Credit card transactions: For purchases on credit cards and For purchases on credit cards and

generation of monthly statements.generation of monthly statements.► Telecommunication:Telecommunication: For keeping records of calls made, generating For keeping records of calls made, generating

monthly bills, maintaining balances on prepaid calling cards, and monthly bills, maintaining balances on prepaid calling cards, and storing information about the communication networks.storing information about the communication networks.

► Finance:Finance: For storing information about holdings, sales, and For storing information about holdings, sales, and purchases of financial instruments such as stocks and bonds.purchases of financial instruments such as stocks and bonds.

► Sales:Sales: For customer, product and purchase information. For customer, product and purchase information.► Manufacturing:Manufacturing: For management of supply chain and for tracking For management of supply chain and for tracking

production of items in factories, inventories of items in production of items in factories, inventories of items in warehouses/stores, and orders for items.warehouses/stores, and orders for items.

► Human resources:Human resources: For information about employees, salaries, For information about employees, salaries, payroll taxes and benefits, and for generation of paycheckspayroll taxes and benefits, and for generation of paychecks

Page 11: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 11

DBMSDBMS►What is DBMS?What is DBMS?

o A A database-management system database-management system (DBMS(DBMS)) is a piece of software that is a is a piece of software that is a collection of interrelated data and a set of collection of interrelated data and a set of programs to access those data.programs to access those data.

o The collection of data, usually referred to The collection of data, usually referred to as the database, contains information as the database, contains information relevant to an enterprise.relevant to an enterprise.

o The primary goal of a DBMS is- to provide The primary goal of a DBMS is- to provide a way to store and retrieve database a way to store and retrieve database information that is both information that is both convenientconvenient and and efficientefficient

Page 12: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 12

Advantages of DBMSAdvantages of DBMSo Data isolation:Data isolation: The DBMS can provide an The DBMS can provide an

abstract view of the data to isolate data from abstract view of the data to isolate data from misuse.misuse.

o Efficient data access:Efficient data access: A DBMS utilizes a A DBMS utilizes a variety of sophisticated techniques to store variety of sophisticated techniques to store and retrieve data efficiently.and retrieve data efficiently.

o Data integrity and Consistency:Data integrity and Consistency: Integrity Integrity means condition to data. Provide some checks means condition to data. Provide some checks and key constraints not to data miss use. and key constraints not to data miss use. Consistency means before transaction and Consistency means before transaction and after transaction database will remain after transaction database will remain consistence.consistence.

Page 13: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 13

Advantages of Advantages of DBMS…DBMS…

o Data administration:Data administration: When several users When several users share the data, centralizing the share the data, centralizing the administration of data can offer significant administration of data can offer significant improvements.improvements.

o Concurrent access and crash recovery:Concurrent access and crash recovery: A A DBMS schedules concurrent accesses to the DBMS schedules concurrent accesses to the data in such a manner that users can think of data in such a manner that users can think of the data as being accessed by only one user the data as being accessed by only one user at a time. Further, the DBMS protects users at a time. Further, the DBMS protects users from the effects of system failures.from the effects of system failures.

o Data Security:Data Security: DBMS provides a robust DBMS provides a robust security from the malicious destruction using security from the malicious destruction using authorization and authentic techniques.authorization and authentic techniques.

Page 14: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 14

File systems vs. a DBMSFile systems vs. a DBMSFile SystemFile System DBMSDBMS

1. Operating system accesses data 1. Operating system accesses data directly and it manages itself.directly and it manages itself.

1. Operating system can not access data 1. Operating system can not access data directly when computer switch on.directly when computer switch on.

2. It is Flat file which means it can be 2. It is Flat file which means it can be opened anywhere.opened anywhere.

2. It is not Flat file. Database 2. It is not Flat file. Database Management System program needs to Management System program needs to open data.open data.

3. Operating systems provide only a 3. Operating systems provide only a password mechanism for security. This password mechanism for security. This is not sufficient flexible to enforce is not sufficient flexible to enforce security policies.security policies.

3. DBMS provides security system for 3. DBMS provides security system for accessing data. That is why, improper accessing data. That is why, improper user cannot access data randomly.user cannot access data randomly.

4. If the size of the file large (above 4. If the size of the file large (above 500GB), RAM size must be large. 500GB), RAM size must be large.

4. RAM size does not depend on data, 4. RAM size does not depend on data, because DBMS always selective type. because DBMS always selective type. That is required data are stored in RAM.That is required data are stored in RAM.

5. Concurrent access and crash 5. Concurrent access and crash recovery can not possible. Operating recovery can not possible. Operating system does not responsible for this.system does not responsible for this.

5. A DBMS schedules concurrent 5. A DBMS schedules concurrent accesses to the data in such a manner accesses to the data in such a manner that users can think of the data as being that users can think of the data as being accessed by only on user at a time. accessed by only on user at a time. Further, the DBMS protects users from Further, the DBMS protects users from the effects of system failures. the effects of system failures.

Page 15: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 15

View of DataView of Data► Abstraction: Data Abstraction means hiding basic

data or meta data from all kind of users using views.

Page 16: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 16

Levels of AbstractionLevels of Abstraction

► Physical level:Physical level: describes how a record (e.g., describes how a record (e.g., customer) is stored.customer) is stored.

► Logical level:Logical level: describes data stored in describes data stored in database, and the relationships among the database, and the relationships among the data.data.

typetype customer = customer = recordrecordnamename : string; : string;streetstreet : string; : string;citycity : integer; : integer;

endend;;► View level:View level: application programs hide details of application programs hide details of

data types. Views can also hide information data types. Views can also hide information (e.g., salary) for security purposes.(e.g., salary) for security purposes.

Page 17: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 17

Instances and SchemasInstances and Schemas

► Similar to types and variables in programming Similar to types and variables in programming languageslanguages

► SchemaSchema – the logical structure of the database – the logical structure of the database

o Analogous to type information of a variable in a programAnalogous to type information of a variable in a programo Physical schemaPhysical schema:: database design at the physical level database design at the physical levelo Logical schemaLogical schema:: database design at the logical level database design at the logical level

► InstanceInstance – the actual content of the database at a – the actual content of the database at a particular point in time particular point in time

o Analogous to the value of a variableAnalogous to the value of a variable

Page 18: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 18

Data ModelsData Models► Model means structure. A collection of tools for describing Model means structure. A collection of tools for describing

data data data relationshipsdata relationships data semanticsdata semantics data constraintsdata constraints

► Types of Data ModelsTypes of Data Models1.1. Entity-Relationship modelEntity-Relationship model2.2. Relational modelRelational model3.3. Other models: Other models:

a)a) Object-oriented modelObject-oriented modelb)b)Object relational data modelsObject relational data modelsc)c) Older models: network model and hierarchical modelOlder models: network model and hierarchical model

Page 19: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 19

Hierarchical database modelHierarchical database model► A A hierarchical database modelhierarchical database model is a data model in which the  is a data model in which the

data is organized into a data is organized into a tree-liketree-like structure. The structure structure. The structure allows representing information using parent/child allows representing information using parent/child relationships: each parent can have many children, but each relationships: each parent can have many children, but each child has only one parent (also known as a child has only one parent (also known as a 1-to-many 1-to-many relationshiprelationship). All attributes of a specific record are listed ). All attributes of a specific record are listed

under an entity type.under an entity type. ► In a database an entity type is the equivalent of a table. Each In a database an entity type is the equivalent of a table. Each

individual record is represented as a row, and each attribute individual record is represented as a row, and each attribute

as a column.as a column.

Page 20: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 20

Network modelNetwork model► The The network modelnetwork model is a database model conceived as a  is a database model conceived as a

flexible way of representing objects and their relationships. Its flexible way of representing objects and their relationships. Its distinguishing feature is that the schema, viewed as a graph distinguishing feature is that the schema, viewed as a graph in which object types are nodes and relationship types are in which object types are nodes and relationship types are

arcs, is not restricted to being a hierarchy or lattice.arcs, is not restricted to being a hierarchy or lattice. ► The network model's original inventor was Charles Bachman, The network model's original inventor was Charles Bachman,

and it was developed into a standard specification published and it was developed into a standard specification published in 1969 by the CODASYL Consortium. in 1969 by the CODASYL Consortium.

Page 21: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 21

Entity-relationship modelEntity-relationship model► In software engineering, an In software engineering, an entity-relationship entity-relationship

modelmodel ( (ER modelER model for short) is an abstract and  for short) is an abstract and conceptual representation of data.conceptual representation of data.

► Entity-relationship modeling is a database Entity-relationship modeling is a database modeling method, used to produce a type of modeling method, used to produce a type of conceptual schemaconceptual schema or  or semantic data modelsemantic data model of a  of a system, often a relational database, and its system, often a relational database, and its requirements in a top-down fashion. Diagrams requirements in a top-down fashion. Diagrams created by this process are called created by this process are called entity-entity-relationship diagramsrelationship diagrams or  or ER diagramsER diagrams. .

► This article refers to the techniques proposed in This article refers to the techniques proposed in

Peter Chen'sPeter Chen's 1976 paper. 1976 paper.

Page 22: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 22

Entity-relationship model…Entity-relationship model…► E-R model of real worldE-R model of real world

o Entities (objects)Entities (objects) o Example.-customers, accounts, bank branchExample.-customers, accounts, bank branch

o Relationships between entitiesRelationships between entitieso Example- Account A-101 is held by customer JohnsonExample- Account A-101 is held by customer Johnsono Relationship set Relationship set depositordepositor associates associates customerscustomers with with

accountsaccounts

► Widely used for database designWidely used for database design Database design in E-R model usually converted to design in the Database design in E-R model usually converted to design in the

relational model (coming up next) which is used for storage and relational model (coming up next) which is used for storage and processingprocessing

Page 23: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 23

Relational ModelRelational Model► Relational Model is a tabular representation of ERD Relational Model is a tabular representation of ERD

Model.Model.► In this model all tables are related with some In this model all tables are related with some

relationsrelations..► Example of tabular data in the relational modelExample of tabular data in the relational model

Page 24: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

A Sample Relational A Sample Relational DatabaseDatabase

04/10/23 24

Page 25: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 25

A Sample Relational Database A Sample Relational Database (Cont.)(Cont.)

Page 26: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 26

Database LanguageDatabase Language

►Language is a way of communication.

►Database Language means a way to communicate with Database and users.

► Two types of Database Languages-

► Data Definition Language( DDL ),►Data Manipulation Language ( DML).

Page 27: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 27

Data Definition Language (DDL)Data Definition Language (DDL)► Specification notation for defining the database Specification notation for defining the database

schemaschemao Example- Example-

create tablecreate table accountaccount ( ( account-numberaccount-number charchar(10),(10), balancebalance integerinteger))

► DDL compiler generates a set of tables stored in a DDL compiler generates a set of tables stored in a data dictionarydata dictionary

► Data dictionary contains metadata (i.e., data about Data dictionary contains metadata (i.e., data about data)data)

o DDatabase schemaatabase schema o Data Data storage and definitionstorage and definition language language

► language in which the storage structure and access language in which the storage structure and access methods used by the database system are specifiedmethods used by the database system are specified

►Usually an extension of the data definition languageUsually an extension of the data definition language

Page 28: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 28

Data Manipulation Language Data Manipulation Language (DML)(DML)

►Language for accessing and manipulating Language for accessing and manipulating the data organized by the appropriate the data organized by the appropriate data modeldata model DML also known as query languageDML also known as query language

►Two classes of languages Two classes of languages ProceduralProcedural – user specifies what data is required and – user specifies what data is required and

how to get those data how to get those data NonproceduralNonprocedural – user specifies what data is required – user specifies what data is required

without specifying how to get those datawithout specifying how to get those data

►SQL is the most widely used query SQL is the most widely used query languagelanguage

Page 29: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 29

SQLSQL

►SQL: widely used non-procedural SQL: widely used non-procedural languagelanguage E.g. find the name of the customer with customer-id 192-83-7465E.g. find the name of the customer with customer-id 192-83-7465

selectselect customer.customer-namecustomer.customer-namefromfrom customercustomerwherewhere customer.customer-idcustomer.customer-id = ‘192-83-7465’ = ‘192-83-7465’

E.g. find the balances of all accounts held by the customer with E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465customer-id 192-83-7465

selectselect account.balanceaccount.balancefromfrom depositordepositor, , accountaccountwherewhere depositor.customer-iddepositor.customer-id = ‘192-83-7465’ = ‘192-83-7465’ andand depositor.account-number = account.account-numberdepositor.account-number = account.account-number

►Application programs generally access Application programs generally access databases through one ofdatabases through one of Language extensions to allow embedded SQLLanguage extensions to allow embedded SQL Application program interface (e.g. ODBC/JDBC) which allow SQL Application program interface (e.g. ODBC/JDBC) which allow SQL

queries to be sent to a databasequeries to be sent to a database

Page 30: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 30

Database UsersDatabase Users

Users are differentiated by the way they expect to Users are differentiated by the way they expect to interact with the systeminteract with the system

► Application programmersApplication programmers – interact with system – interact with system through DML callsthrough DML calls

► Sophisticated usersSophisticated users – form requests in a database – form requests in a database query languagequery language

► Specialized usersSpecialized users – write specialized database – write specialized database applications that do not fit into the traditional data applications that do not fit into the traditional data processing frameworkprocessing framework

► Naïve usersNaïve users – invoke one of the permanent application – invoke one of the permanent application programs that have been written previouslyprograms that have been written previously E.g. people accessing database over the web, bank tellers, clerical E.g. people accessing database over the web, bank tellers, clerical

staffstaff

Page 31: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 31

Transaction ManagementTransaction Management

► A A transactiontransaction is a collection of operations that is a collection of operations that performs a single logical function in a performs a single logical function in a database applicationdatabase application

► Transaction-management componentTransaction-management component ensures ensures that the database remains in a consistent that the database remains in a consistent (correct) state despite system failures (e.g., (correct) state despite system failures (e.g., power failures and operating system crashes) power failures and operating system crashes) and transaction failures.and transaction failures.

► Concurrency-control managerConcurrency-control manager controls the controls the interaction among the concurrent interaction among the concurrent transactions, to ensure the consistency of the transactions, to ensure the consistency of the databasedatabase

Page 32: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 32

Storage ManagementStorage Management

► Storage manager is a program module that Storage manager is a program module that provides the interface between the low-level provides the interface between the low-level data stored in the database and the data stored in the database and the application programs and queries submitted application programs and queries submitted to the system.to the system.

► The storage manager is responsible to the The storage manager is responsible to the following tasks:following tasks: interaction with the file manager interaction with the file manager efficient storing, retrieving and updating of efficient storing, retrieving and updating of

datadata

Page 33: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 33

Database AdministratorDatabase Administrator► Coordinates all the activities of the database system; Coordinates all the activities of the database system;

the database administrator has a good understanding the database administrator has a good understanding of the enterprise’s information resources and needsof the enterprise’s information resources and needs

► Database administrator's duties include:Database administrator's duties include:

Schema definitionSchema definition Storage structure and access method definitionStorage structure and access method definition Schema and physical organization modificationSchema and physical organization modification Granting user authority to access the databaseGranting user authority to access the database Specifying integrity constraintsSpecifying integrity constraints Acting as liaison with usersActing as liaison with users Monitoring performance and responding to changes in Monitoring performance and responding to changes in

requirementsrequirements

Page 34: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 34

Overall System StructureOverall System Structure

Page 35: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 35

Application ArchitecturesApplication Architectures► Two-tier architecture: E.g. client programs using

ODBC/JDBC to communicate with a database► Three-tier architecture: E.g. web-based

applications, and applications built using “middleware”

Page 36: 6/2/20141 Database System DICT:501 Md. Ariful Islam Khandaker Assistant Professor, IICT. KUET.

04/10/23 36

Thanks to AllThanks to All


Recommended