Management Information Systems
Post on 22-Feb-2016
40 Views
Preview:
DESCRIPTION
Transcript
Management Information Systems
Lection 03Database management system
CLARK UNIVERSITY
College of Professional and Continuing Education (COPACE)
Plan
• Term “Database”• Architecture of database• Data models• Normal forms• Operations of relation algebra• Operations of SQL• DBMS
Term “Database”
• A huge amount of data is entered into computer systems every day.
• Where does this data go and how is it used?• How can it help you on a job?
Term “Database”
Widely database is a collection of facts about real world’s objects if some field.
Field is a part of the real world which we learn for managing: company, university, etc.
Non-structured data
Folder No. 16493, Smith John, 01/01/1976; folder No. 16593, LeVering Barbara, 03/15/1975; folder No. 16693, McCow Robert, 04/14/1976.
Structured data
Structuring is the introduction of agreements on the ways of presenting data.
Folder No. Surname First name Birth date
16493 Smith John 01/01/1976
16593 LeVering Barbara 03/15/1975
16693 McCow Robert 04/14/1976
Database definition
• Database (DB) is a named collection of structured data related to a particular subject area.
• Database management system (DBMS) - a set of software and language tools necessary to create databases, keeping them up to date and organize the search in them the necessary information.
Classification of databases
Centralized
stored in a computer system, which may be the mainframe (access
via terminals) or file server network.
Data processing
Distributedconsists of several parts, which are
stored in different computer network
connection.
Classification of databases
With local access
Access to data
With network access
Classification of databases
Centralized database with network access can have the following architecture:
File-server Client-server Two-level model Three-level model
Architecture “File-level”
1. Input and Display data
3. Implementation of computing functions on the data
2. Data access and search Criteria
1. Keeping the database file
АрхитектArchitecture “File-level”ура файл-сервер
1. The absence of very high performance of the server (most importantly - the required amount of disk space)
2. The database is not running and will not being installed on a server
1. High network traffic
2. Lack of special security arrangements file from the DB
Advantages:
Disadvantages:
АрхитектArchitecture “File-level”ура файл-сервер
Architecture “Client-server”
1. Input and display data2. Implementation of computing functions on data sets
1. Keeping the database file2. Access to the data and
search for certain criteria
Architecture “Client-server”
1. Lower network traffic than the file-server model 2. SQL-Server provides functions to ensure the integrity and security of data
1. In certain cases, some data sets may take quite a substantial amount of place
Advantages:
Disadvantages:
Architecture “Client-server”
1. Input and Display data1. Keeping the database file2. Data access and search by
criteria3. Implementation of computing
procedures on data sets
Two-level architecture
Advantages:
Disadvantages:
1. High demands on the computer server (disk space and speed)
Two-level architecture
1. Significant reduction in network traffic compared to client server 2. High reliability of data storage and processing
Three-level architecture suggest the following application components: a client application ("thin client" or a terminal) connected to the application server, which in turn is connected to the database server.
Three-level architecture
Stored data have a logical structure described by a model of data (data model), supported by the DBMS.
Data model determines the organization of data, constraints and the set of operations that are allowed on the object.
Data models
Hierarchical model Network model Relational model
Data models
The hierarchical model has been developed historically in the first turn. Based on this model it was created the first professional DBMS IMS in the late 60's - early 70‘s (IBM).
Hierarchical model
Links between different entities of data are described by a structured graph or a tree
Hierarchical model
1. Sufficiently high run-time operations on data
1. Complexity of understanding for the average user 2. The presence of redundancy
Advantage:
Disadvantages:
Hierarchical model
Link between the data are described by an arbitrary graph
Network model
1. Minimum redundancy2. Compared to the hierarchical model the network model provides
a great deal in terms of the admissibility of the formation of new links
3. Effective implementation in terms of memory consumption.
1. Complexity of understanding for the average user 2. Weakened control of the accuracy of links
Advantages:
Disadvantages:
Network model
The relational model was proposed by Edgar Cod in 1970.
Based on the concept of relation.
Graphically represented as a ratio of a table.
In a relational database assumes that the user perceives the database as tables.
Relational model
Relational modelFolder No. Surname First name Birth date Group
16493 Smith John 01/01/1976 111
16593 LeVering Barbara 03/15/1975 111
16693 McCow Robert 04/14/1976 112
1. Simplicity and clarity for a wide user, which is the reason of its wide distribution.
1. Necessary redundancy because of the relationships between tables.
Advantage:
Disadvantage:
Relational model
There are alternatives to the terms:
Relational model
Alternative 1 Alternative 1 Alternative 1
Table File Relation
String Record Tuple
Column Field Domain
Primary key
Primary key is a relation attribute (set of attributes) that uniquely identifies each of its records. Student (FolderNo., Surname, First_name, Birth_date, Group)
Folder No. Surname First name Birth date Group
16493 Smith John 01/01/1976 111
16593 LeVering Barbara 03/15/1975 112
16693 McCow Robert 04/14/1976 113
Foreign keyWe can link tables by foreign keys.
Foreign key is an attribute (set of attributes) of relation, which is the key of another relation.
Student(FolderNo., Surname, First_name, Birth_date, Group)Group(Number, Specialisation, Head_of_group)
Indexes
Index is a means to accelerate the search operation records in the table, as well as other operations that use search (retrieval, modification, sorting, etc.)Surname Location Location … Surname
Alekseev 1 1 Alekseev
Afanasiev 4 2 Yakovlev
Kuznecov 1000 3 Mikhailov
Mikhailov 3 4 Afanasiev
… …
Yakovlev 2 1000 Kuznecov
Types of indexes
Primary
The key field is always indexed, so it doesn’t require an additional
index.
Indexes
Secondary• The are used for enforcing
searching and executing queries
• There might be several secondary indexes
• They might include several fields
• The same field can enter different indexes
Data redundancy
Folder No. Surname First name Birth date Group Specialization
15345 Ivanov Ivan 04/15/1989 392 Informatics and Management
15349 Medvedeva Anna 02/13/1989 392 Informatics and Management
15310 Petrov Mikhail 11/12/1989 392 Informatics and Management
15259 Sidorov Nicolay 01/26/1987 591 Informatics and English
15263 Sanin Alexander 10/20/1987 591 Informatics and English
The problem of update Folder
No.Surna
meFirst
nameBirth date
Group
Specialization
Term Course Score
15345 Ivanov Ivan 04/15/1989
492 IM 2 English Good
15345 Ivanov Ivan 04/15/1989
492 IM 2 Theory of algorithms
Excellent
15345 Ivanov Ivan 04/15/1989
392 ?
IM 2 Chemistry Good
15310 Petrov Mikhail 11/12/1989
392 IM 6 English Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Theory of algorithms
Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Chemistry Good
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Architecture of PC
Excellent
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Computer modeling
Excellent
The problem of inserting new data Folder
No.Surname First
nameBirth date
Group Speciali-zation
Term Course Score
15345 Ivanov Ivan 04/15/1989
392 IM 2 English Good
15345 Ivanov Ivan 04/15/1989
392 IM 2 Theory of algorithms
Excellent
15345 Ivanov Ivan 04/15/1989
392 IM 2 Chemistry Good
15310 Petrov Mikhail 11/12/1989
392 IM 6 English Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Theory of algorithms
Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Chemistry Good
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Architecture of PC
Excellent
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Computer modeling
Excellent
15402 Stepanov Andrew 03/29/1991
191 MSIT 1 - -
Нормализация
The normalization of relations represent rules of such formation of relations (tables) that allow to eliminate duplication, inconsistency stored in the database.
E. Codd developed three normal forms of relations and the mechanism, which allows to convert any relation to the third normal form.
Нормализация
Первая нормальная форма (1НФ)
Table is in 1NF if each its cell has always the only atomic value, and there can never be the set of such values.
The table is not in 1NF
Первая нормальная форма (1НФ)
Folder No.
Surname First name
Birth date
Group Speciali-zation
Term Course Score
15345 Ivanov Ivan 04/15/1989
392 IM 2 English Good
Theory of algorithms
Excellent
Chemistry Good
15310 Petrov Mikhail 11/12/1989
392 IM 6 English Satisfactory
Theory of algorithms
Satisfactory
Chemistry Good
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Architecture of PC
Excellent
Computer modeling
Excellent
Table is in 1NF
Первая нормальная форма (1НФ)
Folder No.
Surname First name
Birth date
Group Speciali-zation
Term Course Score
15345 Ivanov Ivan 04/15/1989
392 IM 2 English Good
15345 Ivanov Ivan 04/15/1989
392 IM 2 Theory of algorithms
Excellent
15345 Ivanov Ivan 04/15/1989
392 IM 2 Chemistry Good
15310 Petrov Mikhail 11/12/1989
392 IM 6 English Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Theory of algorithms
Satisfactory
15310 Petrov Mikhail 11/12/1989
392 IM 6 Chemistry Good
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Architecture of PC
Excellent
15259 Sidorov Nicolay 01/26/1987
591 IE 10 Computer modeling
Excellent
Диаграмма функциональных зависимостей для примера БД
«Студент»
Table is in 2NF if it does not contain any non-key attributes which are functionally dependent on part of the key
45
Table is in 3NF if it does not contain any non-key attributes, transitively dependent on the key part
Результат проектирования БД
«Студент»
Folder No.
Surname First name
Birth date
Group
15345 Ivanov Ivan 04/15/1989
392
15310 Petrov Mikhail 11/12/1989
392
15259 Sidorov Nicolay 01/26/1987
591
Group Speciali-zation
392 IM
591 IE
Folder No. Term Course Score
15345 2 English Good
15345 2 Theory of algorithms Excellent
15345 2 Chemistry Good
15310 6 English Satisfactory
15310 6 Theory of algorithms Satisfactory
15310 6 Chemistry Good
15259 10 Architecture of PC Excellent
15259 10 Computer modeling Excellent
SQL
A query language SQL (Structured Query Language) provides an access to information contained in relational databases for users, software and computing systems
Relational algebra
SQL is based on relational algebra operations. Relational Algebra is a set of operations on relations. Relational algebra was developed within the relational model by Codd.Using the relational algebra we can get other relations
Relational algebra
UnionNo. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
No. Surname Name Birth date Group
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
No. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students of group 392
Students of group 591
Result
Intersection
Relational algebra
No. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students of groups 392 and 591
No. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
Students of group 392
ResultNo. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
Substraction
Relational algebraNo. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students of groups 392 and 591
No. Surname Name Birth date Group
15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
Students of group 392
ResultNo. Surname Name Birth date Group
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Selection
Relational algebra
No. Surname Name Birth date Group15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students of groups 392 and 591
No. Surname Name Birth date Group
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students of group 591
SELECT – chooseDISTINC – eliminate the same strings in the output fileFROM – from which tablesWHERE – where if condition is trueGROUP BY – grouping strings by some fieldHAVING – grouping under some conditionОRDER BY – sorting
SELECT [DISTINC] elementsFROM table(s)[WHERE condition][GROUP BY field(s) [HAVING condition]][ORDER BY field(s)]
SQL
SELECT Surname FROM Students
Select surnames of all students
No. Surname Name Birth date Group15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students
SurnameIvanov
Medvedeva
Petrov
Sidorov
Sanin
SELECT * FROM Students WHERE Group=591
ORDER BY Surname
Select all information about students of group 591, sorting them by surname
No. Surname Name Birth date Group15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students
No. Surname Name Birth date Group15263 Sanin Alexander 10/20/1987 591
15259 Sidorov Nikolay 01/26/1987 591
Result
SELECT Birth Date FROM Students WHERE Surname=“Petrov”
Select birth date of Petrov
No. Surname Name Birth date Group15345 Ivanov Ivan 04/15/1989 392
15349 Medvedeva Anna 02/13/1989 392
15310 Petrov Mikhail 11/12/1989 392
15259 Sidorov Nikolay 01/26/1987 591
15263 Sanin Alexander 10/20/1987 591
Students
Birth date11/12/1989
DBMSDatabase management system (DBMS) is a set of software and language tools necessary to create databases, keeping them up to date and organize the search the necessary information.
The term "database server" is generally used to refer to the entire database, based on the "client-server", including the server and client side.
Types of DBMS
Network DBMS (CronosPlus)Hierarchical DBMS (IMS)Rational (MS Access, Paradox, Interbase, FireBird,
MySQL, Oracle, Ingres)Onject-oriented and object-rational (Oracle Database,
MicroSoft SQL Server)
top related