DATABASE CONCEPT
DATABASE CONCEPT
Todays Topics
Difficulty in Access
Data maintained in file
system is difficult to access
in the required format
Data Redundancy
Redundancy means same
data are duplicated in
different places (files).
Data Inconsistency
Data inconsistency occurs
when same data maintained in
different places do not match Data Dependence
Data are stored in a pecific
format or structure in a
file. If the structure or
Controlled Data Sharing ormat itself is changed,
It is very difficult to enforce then it becomes to difficult
user based access control in to arrange data.
a file system
4
What is Database???
Database is a collection of related data and data is a collection of facts
and figures that can be processed to produce information.
In Database, Data is organized in to rows, columns and tables, and it is
indexed to make it easier to find required information.
For example : if we have data about records of students, we can then
arrange them class wise, section wise, gender wise etc.
Table Student:
ADMNO NAME CLASS SECTION GENDER DOB
Row- 0 2163 ASHOK XII A M 2002-11-05
Row- 1 4152 VINAY XI B M 2004-12-06
Row- 2 3434 ANJALI XI B F 2003-01-25
Row- 3 4212 KOUSHIKI X C F 2005-02-18
Row- 4 6214 SUBHAM IX A M 2006-03-02
Row- 5 4141 ARIJIT X C M 2004-06-27
Row- 6 5142 MELANI XII B F 2002-03-16
It reduces redundancy
Data is maintained one place
hence there is no duplication
of data.
It controls inconsistency
Because data is
maintained in one place,
question od data mismatch
Data sharing does not appear.
Data can be easily shared
among different users.
Data Security
Data is very well protected
from accidental or
Data integrity unauthorised access,
It maintains accuracy and through password and
consistency of data. Error other protective methods.
checking and validation are
common methods to maintain
data integrity.
6
What is Dbms???
A database management system (DBMS) or database system in short, is
a software that can be used to create and manage databases.
DBMS lets users to create a database, store, manage, update/modify and
retrieve data from that database by users or application programs.
For example : MySQL, Oracle, PostgreSQL, SQL Server, Microsoft
Access, Mongo DB.
The DBMS serves as an interface between the database and end users or
application programs.
Example of Database in real life situation :
Hospital
Ticket Managem
Banking Booking
School ent
Inventory Resource
Manageme Manage Manage
nt ment ment
Online
Shopping
7
Different types of Databases
Relational Data Model
A data model describes the structure of the database, including how data
are defined and represented, relationships among data, and the
constraints. The most commonly used data model is Relational Data
Model.
A relational database is a collection of multiple datasets organized in
tables by rows and columns. It establish a well-defined relationship
between multiple database tables. Which in return communicate with
each other to search a required data.
In relational model, tables are called relations that store data for
different columns, with all items in a column being homogeneous.
Each table can have multiple columns where each column name
should be unique, having atomic(indivisible) value.
Each row in the table represents a related set of values and no two
rows of relation will be identical.
Each database can contain multiple relations which communicate
with each other to search a required data.
9
Terminologies of DBMS
Domain:
It is a set of values from which an attribute can take a value in each row. Usually, a data
type is used to specify domain for an attribute. For example, in STUDENT relation, the
attribute RollNumber takes integer values and hence its domain is a set of integer
values.
Tuple/Entity/Record/Row:
Each row of data in a relation (table) is called a tuple. In a table with n columns, a tuple
is a relationship between the n related values.
Attribute/Field/Column:
the columns of a relation are the attributes which are also referred as fields. For
example, ADMNO, SName, Class and Section are attributes of relation STUDENT.
Degree:
The number of attributes in a relation is called the Degree of the relation. For example,
relation STUDENT with SIX attributes is a relation of degree 6.
Cardinality
The number of tuples in a relation is called the Cardinality of the relation. For example,
the cardinality of relation STUDENT is 7 as there are 7 tuples in the table.
10
Keys in a Relational Database
Keys:
Relational data model imposes some restrictions or constraints on the values of the
attributes and how the contents of one relation be referred through another relation.
These restrictions are specified at the time of defining the database through different
types of keys as given below:
Candidate Key:
A relation can have one or more attributes that takes distinct values. Any of these
attributes can be used to uniquely identify the tuples in the relation. Such attributes are
called candidate keys as each of them are candidates for the primary key.
Primary Key:
Out of one or more candidate keys, the attribute chosen by the database designer to
uniquely identify the tuples in a relation is called the primary key of that relation.
Alternate Key:
The remaining attributes in the list of candidate keys, which are not primary key are
called the alternate keys.
Foreign Key:
A foreign key is used to represent the relationship between two relations. A foreign key
is an attribute whose value is derived from the primary key of another relation.
11
T H A N K Y O U
12