Database Foundation knowledge
Session 1
Objectives(1)
Explain why we need a database
Explain the evolution of database management
systems
Describe the basic concepts related to a
database
Concepts of RDBMS and SQL Server 2000/Session 1/ 2 of 27
Objectives(2)
Explain the basic
Relational database
concepts
•
Entity integrity
•
Primary key
•
Foreign key
•
Relation and its degree
related
to
a
Describe a brief introduction of SQL
Concepts of RDBMS and SQL Server 2000/Session 1/ 3 of 27
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 different questions.
For example, “What are the phone numbers and
addresses of the five nearest post offices?”
Concepts of RDBMS and SQL Server 2000/Session 1/ 4 of 27
Why 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
Concepts of RDBMS and SQL Server 2000/Session 1/ 5 of 27
Need for permanency
Data storage can be achieved even
using simple manual files.
However, data stored in this form
is not permanent.
Concepts of RDBMS and SQL Server 2000/Session 1/ 6 of 27
Problems with file storage
The process of manually
maintaining data through files is :
Tedious
time consuming
Error prone.
Concepts of RDBMS and SQL Server 2000/Session 1/ 7 of 27
Evolution of DBMS-1
What is a DBMS?
Database
A003
Allen
A007
Shane
A004
Brian
A008
Ricky
Retrieve Data
Insert Data
Update Data
DBMS
Delete Data
Concepts of RDBMS and SQL Server 2000/Session 1/ 8 of 27
Basic Concepts of a
database-1
Data
Player
Matches
Won in
the Series
Information
Lleyton Hewitt
20
Best Player of
the Series
Carlos Moya
15
Lleyton Hewitt
Marat Safin
10
Paradorn
Srichaphan
8
Concepts of RDBMS and SQL Server 2000/Session 1/ 9 of 27
Basic 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
Columns
Rows
and columns
Concepts of RDBMS and SQL Server 2000/Session 1/ 10 of 27
Basic 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.
Concepts of RDBMS and SQL Server 2000/Session 1/ 11 of 27
Basic 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.
Unique key
RollNumber
Name
1
Sam
2
John
3
Jenny
3
Lisa
Wrong
Concepts of RDBMS and SQL Server 2000/Session 1/ 12 of 27
Basic Concepts of a Relational
database-1
Relational
Database
Applications for
interacting with
data in DB
RDBMS
A suite of S/W
programs to create,
maintain DB
Concepts of RDBMS and SQL Server 2000/Session 1/ 13 of 27
Basic Concepts of a Relational
database-2
Entities
Tables
Attributes
Fields
Relations
Concepts of RDBMS and SQL Server 2000/Session 1/ 14 of 27
Basic 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.
Primary Key
Roll
Number
Student Name
1
Sam
2
John
3
Jenny
4
Lisa
5
Penny
6
Peter
7
Joe
Concepts of RDBMS and SQL Server 2000/Session 1/ 15 of 27
Entity 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
Concepts of RDBMS and SQL Server 2000/Session 1/ 16 of 27
Foreign key
Two tables are linked together using a foreign key.
P
F
Roll Number
Student Name
1
Sam
2
John
3
Jenny
2
John
65
4
Lisa
4
Lisa
90
5
Penny
6
Peter
87
6
Peter
7
Joe
89
7
Joe
Roll
Number
Student
Name
Marks
Obtained
Concepts of RDBMS and SQL Server 2000/Session 1/ 17 of 27
Referential 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.
Concepts of RDBMS and SQL Server 2000/Session 1/ 18 of 27
Relation and degree
According to the relational model, every relation or
table is made up of many tuples. They are also
called records.
For eg:
CHN
China
Renminbi (Yuan)
FRN
France
Francs
The number of attributes within a table is called the
degree of that table.
Concepts of RDBMS and SQL Server 2000/Session 1/ 19 of 27