Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TOPIC 6
DATABASE
1. Define
● Database
● Database Management System (DBMS)
2. Describe advantages and disadvantages of database
DATABASE
Database
● Can be define as ;
● An integrated collection of related data OR
● Collection of data organized in a manner that allows access,
retrieval, and use of that data – Shelly & Varmaat, 2012, OR
● A collection of data, manage and organized by a database
management system – Petersen, 2002
● Related data, e.g. : information stored in University
(students, courses, faculty, students taking
courses, faculty teaching courses … )
● Integrated: all data is stored in a uniform way on
secondary storage.
DATABASE
● Database system
– many programs
and users share the
data in the database.
● Example 1: a school’s
database most likely at a
minimum contains data about
students, instructors, schedule
of classes, and student
schedules.
● Example 2: a library’s
database stored data about
book’s title, the author, ISBN
number.
DATABASE
Advantages
1. Sharing data
- data in a database environment is shared over a
network.
2. Easier Access
- better data accessibility using standard data query
language (SQL). allows end-user to access and
maintain data.
3. Reduced data redundancy
- reduce data redundancy/duplication by improving
data sharing.
DATABASE
Advantages (continued)
4. Security
- improved data security (backup recovery, concurrency, access control)
5. Reduced development time
- is easy and fast to develop programs
6. Higher data integrity
- increasing data integrity through data independence from applications
program
7. improve data quality
- reducing update errors (using same format) thus increasing data consistency
DATABASE
Disadvantages
Learning Outcomes
Data
Hierarchy
6.2 Basic Concept of Database
● Data Hierarchy
– refers to the organization of data in a database.
● table/s or file/s
● record/s (in rows)
● field/s (in columns)
● character
6.2 Basic Concept of Database
● Data Hierarchy
– a database contains one or more
tables. A table contains a number of
records. A record contains one or
more fields.
6.2 Basic Concept of Database
● Data Hierarchy
– a database files stored on disk (usually
stored in the form of tables) , each files
has its own records and each records
has its own fields.
6.2 Basic Concept of Database
Explain:
• Contact Management features in any
mobile phone is an example of
touch on Save
database in your device (because it is
to keep the
an organized collection of data – your
new contact
friend’s contact number stored in your
(that you’ve
phone)
just added) in
• Create contact enable you to see many
your phone
field (NAME, MOBILE, HOME .. ) – in
that case it is a table with a lot of fields
(depends on user to add or to remove
fields)
• When you Save, you actually saving –
a record in your phone.
6.2 Basic Concept of Database
Field
6.2 Basic Concept of Database
Data
Dictionary
and
Data Type
6.2 Basic Concept of Database
a *repository in database,
contains data about files in the
database and each field in those files
- Shelly & Vermaat, 2012
6.2 Basic Concept of Database
List 3 - 4 examples of
data that can be extract
from student.
Primary Key
and
Foreign Key
6.2 Basic Concept of Database
6.2 Basic Concept of Database
Explain:
1st Table
2nd Table
Relational /
Relationships
Line
Connecting 1st
and 2nd Table
6.2 Basic Concept of Database
Explain:
Remember !
• In Table #2, Hostel Info, field Room
Num is the PK (for that table), and
Matric_Num is the Foreign Key
(because it matches primary key form
Foreign Key (in database) – a field in another table ,Table #1).
relational table, that matches primary
key column of another table.
6.2 Basic Concept of Database
Conclusion:
A foreign key (sometimes called a
referencing key) is ;
• key used to link two tables
together.
• taking primary key field
from one table and insert it
Remember !
into the other table (where it
becomes a foreign key).
Entity Relationship
- A data model that describes data and
information, implemented in a
relational database
6.2 Basic Concept of Database
Entity
Relationship
• Something of importance to the
• An association between data that's
organization.
stored in different record types.
• Entities that the organization
• Important because typically describes
wants to store data about typically
an association between two or more
becomes a database table.
entities.
• Person, place, object, event or
Cardinality
concept in the user environment
about which the organization • Important aspect of the relationship
wishes to maintain data. between record types.
• “thing” or object that contain • Number of associations that can exist
data. between two record types.
• Represented by a rectangle in E-R Attributes
(entity-relationship) diagrams • Characteristic of an entity.
TERM EXAMPLES
Entity (a noun) Product, Name, Book, Student,
Model, Lecturer, Staff
Relationship (a verb)
a diamond shape
Attribute (entity’s
property) an oval shape
6.2 Basic Concept of Database
Identify
• How many entity are
there in the
ER-diagram ?
• Which entity has the
most attributes ?
• List the attributes for
entity label Mark
• What is the
relationship
between Student
and Teacher ?
Example of ER-Diagram
(Entity-Relationship Diagram)
6.2 Basic Concept of Database
Example 1
2 entity, Teacher and Subject, the
relationship is supervise,
Cardinality is 1:1
Example 1
2 entity, Football Team and Player,
the relationship is join,
Cardinality is 1:M
Example 1
Learning Outcome:
1
DATABASE
2
DATABASE
3
DATABASE
10122
EmployerNameEmployerAddress PhoneNumber
10191
Inn
Windsor Alpine
Charlottetown PE C1A 8R4
14 Longmeadow Road, 603-266-9233
E
Tours Laconia, NH 03246
10190
Country Club
The Briar Rose
Brewster, MA 02631
105 Queen Street, 902-626-1595
L
Inn Charlottetown PE C1A 8R4
10191 Windsor Alpine
Tours
14 Longmeadow Road,
Laconia, NH 03246
603-266-9233 E
10198 Trudel Spa & 40 Rue Rivard, North Hatley 819-842-7783
Resort QC JOB 2C0
Field - A single characteristic or attribute of a person, place, object,event or idea
DATABASE
R
10125 Boston Harbor 75 Atlantic Avenue, Boston,
Excursions MA 02110
617-235-1800
B
e 10126 BaySide Inn & 354 Oceanside Drive, 508-283-5775
c
10190
Country Club
The Briar Rose
Brewster, MA 02631
105 Queen Street, 902-626-1595
L
o Inn Charlottetown PE C1A 8R4
r
d
10191 Windsor Alpine
Tours
14 Longmeadow Road,
Laconia, NH 03246
603-266-9233 E
s 10198 Trudel Spa & 40 Rue Rivard, North Hatley 819-842-7783
Resort QC JOB 2C0
11 Record - A set of related field values.
DATABASE
10125
Bean Town Tours 105 State Street, Boston, MA 617-451-1970
02109
Boston Harbor 75 Atlantic Avenue, Boston, 617-235-1800
B
10126
Excursions MA 02110
BaySide Inn & 354 Oceanside Drive,
Country Club Brewster, MA 02631
508-283-5775 L
10190 The Briar Rose 105 Queen Street,
Inn Charlottetown PE C1A 8R4
902-626-1595
E
10191 Windsor Alpine 14 Longmeadow Road, 603-266-9233
Tours Laconia, NH 03246
10198 Trudel Spa & 40 Rue Rivard, North Hatley 819-842-7783
Resort QC JOB 2C0
12
DATABASE
Definition:
•
F
O
● A window on the screen that provides areas
for entering or modifying data in a database R
● Functions
• :
○ To retrieve and maintaining, viewing and M
printing records in a database.
○ Present a friendlier interface than a table.
○ Allows viewing data one record at a time
15
DATABASE
17
DATABASE
Function: Q
- A query is a way to get specific information from
the database.
U
- A means of asking questions (querying) of your E
data
- Can look across a number of Tables and other R
Queries
- Can perform calculations and Combine fields
Y
20
DATABASE
10191
Inn
Windsor Alpine
Charlottetown PE C1A 8R4
14 Longmeadow Road, 603-266-9233
Y
Tours Laconia, NH 03246
10198 Trudel Spa & 40 Rue Rivard, North Hatley 819-842-7783
Resort QC JOB 2C0
21
DATABASE
•
➢ User
•
request for Employer’s Name and
Phone Number. Q
What
• will be displayed in the Query?
EmployerID EmployerName EmployerAddress PhoneNumber
U
10122 Bean Town Tours 105 State Street, Boston, MA 617-451-1970
10191
Inn
Windsor Alpine
Charlottetown PE C1A 8R4
14 Longmeadow Road, 603-266-9233
Y
Tours Laconia, NH 03246
10198 Trudel Spa & 40 Rue Rivard, North Hatley 819-842-7783
Resort QC JOB 2C0
23
DATABASE
Example:
A Report based on Query for Employers which located in Boston.
R
REPORT : Employer List based in Boston E
ID: 10122
Name: Bean Town Tours
Address: 105 State Street, Boston, MA 02109
P
Phone Number: 617-451-1970
O
ID: 10125
Name: Boston Harbor Excursions
Address: 75 Atlantic Avenue, Boston, MA 02110
R
Phone Number: 617-235-1800
T
30
DATABASE
Example:
A Report based on Query for Employer’s name and phone number
To describe the
and columns
REFERENCES
34