Professional Documents
Culture Documents
01 Data Database Intro 2017
01 Data Database Intro 2017
1
Executive Summary
• Why databases?
• What is a database?
• Web vs. database
• Approaches to data management
• Data modelling
• E-R model
• Review questions
2
Databases are in your life
• Shift from computation to information
• True in corporate computing for years
• Web, p2p networks made this clear for personal computing
• Increasingly true of scientific computing
• Need for database technology has exploded in the last years
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
3
Databases are in your life
4
Database Systems Then
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
5
Database Systems Today
6
6
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
Database Systems Today
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
7
7
Database Systems Today
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
8
Database Systems Today
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
9
9
So… What is a Database?
10
Database Management System
• A Database Management System (DBMS) is:
– A software designed to store, manage, and facilitate access
to databases.
– It provides interface between database and application
program
• Purpose of DBMS:
– To define and construct the database and to manipulate
with it
Source: http://inst.eecs.berkeley.edu/~cs186/fa05/lecs/
11
Database system (DBS)
Information system (IS)
DBMS
Database (DB)
12
Database Management System (DBMS)
13
Database system (DBS)
• It works according to the equation:
DBS = DB + DBMS
• Data are organized in database (DB) and
managed by database management system
(DBMS)
14
Beware terminology
15
MS Access 2013
Source: own
16
MS SQL Manager
17
MySQL Manager
18
Database design – Critical topic
• What do I want?
– (Outputs)
• What have I got?
– (Inputs)
• What do I need to do to get
there?
– (Process)
19
Define your needs first
• Draw a picture
• Write a description PRODUCTS
SUPPLIERS
ORDERS
C.C.
EMPLOYEES Toys
20
Introduction to MS Access
21
MS Access Modes
22
Database Terminology
23
Database Terminology (cont.)
24
To be continued at lecture no. 2 …
25
Managing digital data
26
• A database is a logically organized collection of
related data designed and built for a specific
purpose
• Data is stored hierarchically for easier storage and
retrieval
• File (table): collection of related records
– Records (row): collections of related fields
• Field (column): unit of data containing 1 or more
characters
– Character [Byte]: a letter number or special character
made of bits
» Bit: 0 or 1
Source: Williams: Using Information Technology, 10e, 2013
27
Data Storage Hierarchy
28
Files vs. Database
• Data stored in files (traditional)
Eg. MyHomework.doc
+ Good portability
+ Supported by the operating system (OS) ->
no special software needed
- Program/data dependency
- Trouble with sharing data
29
Files vs. Database
• Data in database
30
Files vs. Databases
• Thought Experiment 1:
– You and your project partner are editing the same file.
– You both save it at the same time.
– Whose changes survive?
32
How to Create a Database?
• Firstly, to set a data model for database
• Data model is:
– a plan for building a database
– a representation of data structure required by a
database
• Data model includes:
– data objects (=entities),
– associations between data objects
(=relationships),
– rules which govern operations on the objects
• Data model is independent of hardware or software
33
Why Data Model?
34
Data model
35
Methods for Data Model
1. Hiercharchical model
2. Network model
3. Entity-relationship model (E-R model)
4. Object-oriented model
36
E-R Model
37
Database examples
38
E-R Model Background
39
E-R Model
Entity STUDENT
• Is a data object
(concrete or abstract) to
collect information about it
• It has its name, eg. EMPLOYEE, BOOK, STUDENT,
etc.
Even there are many employees, many books and many students, the
singular is used for the name
• Will be represented as a table later in the relational
database
40
E-R Model
STUDENT
Attribute Name
• Describes the entity Surname
Birth date
• An instance attribute
is a single value of an attribute for an instance of
entity (eg. “John” for attribute Name)
• Collection of all possible values
of an attribute is a domain (eg. Character string, date,
number, etc.)
41
E-R Model
Relationship STUDENT STUDY GROUP
or more entities
• Eg. „Student belongs to study groups“
• Relationships are classified in terms of degree,
connectivity, cardinality and existence
42
E-R Model
Relationship - cardinality
• Is a number of occurences for
a particular entity STUDENT STUDY GROUP
• one-to-many (1:N)
• many-to-many (N:N)
43
Examples and explanations of
relationships
• Student – Student‘s book is 1:1 (Explanation: each
student has its own one unique index and each index
belong only to one student)
• Student – Study group is N:1 (Explanation: each
student belongs only to one study group, but each
study group has one or more students)
• Student – Subject is M:N (Explanation: each student
can have one or more subjects, conversely one
subject can be attended by one or more students)
44
E-R Model
45
Steps In Building the Data Model
(simplified)
1. Identify data objects and relationships
2. Draft the initial E-R diagram with entities and
relationships
3. Refine the E-R diagram
4. Add key attributes to the diagram
5. Add non-key attributes
46
Data Model – Example 1
47
Data Model – Example 2
48
Review Questions - 2
1. What is the first step before we create a database?
2. Why is data model so important for building database? Give two
reasons.
3. Give the list of steps that are necessary for data model design.
4. What is the E-R model? Explain.
5. What is the entity in E-R model? Give two examples.
6. Fill in correct words (entity, attribute, instance of attribute, domain) in
the assignment:
“In the E-R model of books in library, the “Book” is an …… in the
model. The book must have information about the author, the title of
book, the publisher name and the year of publishing that are
represented as …….. in the model . If there is a book “Lord of the
Rings” , it is an ………. of the attribute “book title”. The “book title”
could be represented only as a text value, which is the ……”
49
Review Questions - 2
50