What is a database?A database is an organized form of data consisting of one or more related data items called records.. A database is like a data collection to which we can ask differe
Trang 1Database Foundation
knowledge Session 1
Trang 2 Explain why we need a database
Explain the evolution of database management
systems
Describe the basic concepts related to a
database
Trang 3 Explain the basic concepts related to a Relational database
• Entity integrity
• Primary key
• Foreign key
• Relation and its degree
Describe a brief introduction of SQL
Trang 4What is a database?
A database is an organized form of data consisting
of one or more related data items called records
A database is like a data collection to which we can ask different questions
For example, “What are the phone numbers and addresses of the five nearest post offices?”
Trang 5Why use databases?
Databases are used to store data in an efficient and organized manner A database allows us quick and easy management of data
For example, a company may maintain details of its employees in a database
FirstName LastName Hiredate
Karla Jablonski 1994-03-11 Martine Rance 1992-02-05 Margaret Smith 1988-09-29 Gary Thomas 1988-08-09
Trang 6Need for permanency
Data storage can be achieved even
using simple manual files
However, data stored in this form
is not permanent
Trang 7Problems with file storage
The process of manually
maintaining data through files is :
Tedious
time consuming
Error prone.
Trang 8Evolution of DBMS-1
Retrieve Data
Insert Data
Update Data Delete Data
Brian A004
Allen
A003
Ricky A008
Shane A007
Database
What is a DBMS?
Trang 9Basic Concepts of a
database-1
Data
Player Matches Won in
the Series
Lleyton Hewitt 20
Carlos Moya 15
Marat Safin 10
Paradorn
Srichaphan 8
Information
Best Player of the Series
Lleyton Hewitt
Trang 10Basic Concepts of a
database-2
Tables are database
objects that contain
all the data present
in a database
Data in a table is
arranged in rows
and columns
Columns
Row s
Trang 11Basic Concepts of a
database-3
A database system is a computer-based record keeping system whose overall purpose is to record and maintain information
A DBMS is a collection of related records and a set of programs that access and manipulates these records
Trang 12Basic Concepts of a
database-4
Duplication of data or
‘data redundancy’ can be
reduced using a database
management system
Ensuring the accuracy of
data in the database is
called maintaining the
integrity of data
RollNumber Name
Unique key
Trang 13Basic Concepts of a Relational
database-1
Applications for
interacting with
data in DB
Relational Database
RDBMS
A suite of S/W programs to create,
maintain DB
Trang 14Basic Concepts of a Relational
database-2
Entities
Attributes
Relations
Tables
Fields
Trang 15Basic concepts of Relational
Database-3
A database is a collection
of tables Each table
contains information about
a single entity
A primary key is a column
or combination of columns
that uniquely identifies a
record
Roll Number Student Name
1 Sam
2 John
3 Jenny
4 Lisa
5 Penny
6 Peter
7 Joe
Primary Key
Trang 16Entity Integrity
The Entity integrity rule
states that no component
of the primary key of a
base table should be
allowed to accept NULL
values
A NULL value is a missing
value
Roll Number Student Name
1 Sam
2 John
3 Jenny
4 Lisa
5 Penny
Peter
7 Joe
Invalid
Trang 17Foreign key
Two tables are linked together using a foreign key
Roll Number Student Name
1 Sam
2 John
3 Jenny
4 Lisa
5 Penny
6 Peter
7 Joe
Roll Number Student Name Marks Obtained
2 John 65
4 Lisa 90
6 Peter 87
7 Joe 89
P
F
Trang 18Referential Integrity
The Referential integrity rule states that a
database must not contain any unmatched foreign key values
The DBMS is responsible for ensuring that the
attribute values in the foreign key are valid and
have a corresponding match in the relation where
the attribute is a primary key
Trang 19Relation and degree
The number of attributes within a table is called the degree of that table
CHN China Renminbi (Yuan) FRN France Francs
According to the relational model, every relation or table is made up of many tuples They are also
called records
For eg: