PT MOHAN LAL SD COLLEGE FOR WOMEN , GURDASPUR
Presented by :Mrs.Surkhab Shelly
Astt. Prof. in computer Science
Deptt.
DATABASE :Acollection of data is referred to as
database.
e.g. 1.record of students storedin files
2. information stored over internet
DATABASE MANAGEMENT SYSTEM: A Data Base
Management System (DBMS) is a set of software programs that
enables users to define, create and maintain a database. It is
basically a computer based recordkeeping system (program).
MySQL
Microsoft Access
FileMaker
FoxPro
Purpose of database :
1.It reduces DATA REDUNDANCY to a largeextent.
2. It controls DATA INCONSISTENCY.
3. It facilitate SHARING of data.
4. It ensures DATA SECURITY.
Name D.O.B Fees
Harsh 23/01/1993 Not paid
Amar 04/11/1994 Paid
Devendra 14/06/1992 Not paid
Harsh 23/01/1993 Not paid
Name D.O.B Fees
Harsh 23/01/1993 Paid
Amar 04/11/1994 Paid
Devendra 14/06/1992 Paid
Harsh 23/01/1993 Not paid
Data Redundancy Data Inconsistency
Three levels of dataabstraction
View 1 View 2 View 3
Conceptual
level
Physical
level
External level
Internal
Stored-acc.
Account #
Name
Type
Amount
length=60
type=bytes(15) offset=0
type=bytes(20) offset=15
type=bytes(10) offset=35
type=bytes(15) offset=45
Conceptual
AC_No
AC_Name
Type
Amount
numeric(15)
character(20)
character(10)
numeric(15)
View 1
AC_Name
Amount
View 2
AC_No
AC_Name
Type
Amount
Accountholder Manager
(DBMSProgrammer)
Database
handler
User
Various levels of database implementation (concept ofabstraction)
1.INTERNALLEVEL(PHYSICAL LEVEL):
It describes how data are actually stored on the storage
medium.
It is closest to database programmer.
Lowest level of database abstraction.
2. CONCEPTUAL LEVEL:
It describes what data are actually stored in database.
It is closest to thedatabase manager.
It is an intermediate level of databaseabstraction.
•EXTERNAL LEVEL(VIEW LEVEL):
It describes the way in which the data are viewed by individual
user.
It is the level closest to the users.
Item # Item-
name
Price
I1 Cake 50.00
I2 Bread 9.00
I3 Biscuits 6.00
I4 Snacks 16.00
1.Relational DataModel
Supp# Supp-name
S1 Britannia
S2 New Bakers
Supp# Item# Qty-
Supplie
d
S1 I2 20
S1 I3 25
S1 I4 10
S2 I1 5
S2 I3 10
Table : Items
Table : Suppliers
Table : Shipments
1.RELATIONAL DATA MODEL: In relational data model, the
data is stored in the form of tables (i.e. rows ad columns).
These tables are calledrelations.
The user of the relational databasesystem may insert new tuples,
delete tuples, and modifytuples.
DATA MODELS
S1 Britannia
20 25 10
I2 Bread 9.00 I3 Biscui 6.00
ts
I4 Snacks 16.00
2. Network DataModel
2. NETWORK DATA MODEL: The network data model differs
from the relational model.In this model data is represented by
connection of records and relationships among data are
represented by links.Records are organized as graphs.
S1 Britannia
20
25
10
I3
I2 Bread 9.00
Biscuits 6.00
I4 Snacks 16.00
3. Hierarchical DataModel
3. HIERARCHICAL DATA MODEL: Data is represented by
collection of records and relationships among data by links, similar
to the network model.
Records are organized as trees rather than graphs.
Represents relationship among its records through parent child
relationships.
The relational model was put forward by E.F. Codd of the
IBM. It is considered as a very important concept in
DBMS.
Some basic terminologies
Relation : A relation is a table i.e. data is arranged in rows and
columns.
Tuple : The rows of tables are generally referred to as tuples.
Attributes : The columns of tables are generally referred to as
attributes.
Degree : The number of attributes in a relation determine the
degree of the relation.
Cardinality : The number of tuples in a relation is called the
cardinality of the relation.
Relational Data Model
Normalization
Normalization is a systematic way of ensuring that a
database structure is suitable for general-purpose
querying and free of certain undesirable characteristics
that could lead to a loss of data integrity.
The objectives of normalization:
 Free the database of modification anomalies
 Minimize redesign when extending the database
structure
 Make the data model more informative to users
 Avoid bias towards any particular pattern of querying
In general, relational databases should be normalized to
the "third normal form".
Background to Normalization: Definitions
Functional Dependency:
If A and B are attributes of relation R, B is functionally
dependent on A (denoted A  B), if each A value is
associated with precisely one B value.
Or in other words, In every possible legal value of R (relation),
whenever two tuple agree on their A values, they also agree
on their B value.
Determinant of a functional dependency refers to attribute
or group of attributes on left-hand side of the arrow.
e.g. in an "Employee" table that includes the attributes
"Employee ID" and "Employee Date of Birth", the functional
dependency {Employee ID} →
{Employee Date of Birth} would hold.
Background to Normalization: Definitions
Full Functional Dependency
 A and B are attributes of a relation,
 B is fully dependent on A if B is functionally dependent on A but
not on any proper subset of A.
A functional dependency X  Y is full functional dependency if removal of
any attribute A from X means that the dependency does not hold any
more.
Background to Normalization: Definitions
Transitive Dependency: A transitive dependency is an indirect functional
dependency. Let A, B, and C designate three distinct attributes in the
relation. Suppose all three of the following conditions hold:
 A → B
 It is not the case that B → A
 B → C
Then the functional dependency A → C is a transitive dependency.
The functional dependency {Book} → {Author Nationality} applies; that is, if
we know the book, we know the author's nationality. Furthermore:
 {Book} → {Author}
 {Author} → {Author Nationality}
 {Author} does not → {Book}
Therefore {Book} → {Author Nationality} is a transitive dependency.
Background to Normalization: Definitions
SuperKey: A superkey is a set of columns within a table whose values can be
used to uniquely identify a row.
e.g. Imagine a table with the fields <Name>, <Age>, <SSN> and <Phone
Extension>. This table has many possible superkeys. Three of these are
<SSN>, <Phone Extension, Name> and <SSN, Name>. Of those
listed, only <SSN> is a candidate key, as the others contain information
not necessary to uniquely identify records
A candidate key is a key that can be used to uniquely identify record. I.e., it
may be used to retrieve one specific record.
The primary key of a relation is a candidate key that has been designated
as the main key.
A foreign key is an attribute (or collection of attributes) in a relation that can
be used as a key to another relation. Foreign keys link tables together to
form an integrated database.
Dbms ppt

Dbms ppt

  • 1.
    PT MOHAN LALSD COLLEGE FOR WOMEN , GURDASPUR Presented by :Mrs.Surkhab Shelly Astt. Prof. in computer Science Deptt.
  • 2.
    DATABASE :Acollection ofdata is referred to as database. e.g. 1.record of students storedin files 2. information stored over internet DATABASE MANAGEMENT SYSTEM: A Data Base Management System (DBMS) is a set of software programs that enables users to define, create and maintain a database. It is basically a computer based recordkeeping system (program). MySQL Microsoft Access FileMaker FoxPro
  • 3.
    Purpose of database: 1.It reduces DATA REDUNDANCY to a largeextent. 2. It controls DATA INCONSISTENCY. 3. It facilitate SHARING of data. 4. It ensures DATA SECURITY. Name D.O.B Fees Harsh 23/01/1993 Not paid Amar 04/11/1994 Paid Devendra 14/06/1992 Not paid Harsh 23/01/1993 Not paid Name D.O.B Fees Harsh 23/01/1993 Paid Amar 04/11/1994 Paid Devendra 14/06/1992 Paid Harsh 23/01/1993 Not paid Data Redundancy Data Inconsistency
  • 4.
    Three levels ofdataabstraction View 1 View 2 View 3 Conceptual level Physical level External level Internal Stored-acc. Account # Name Type Amount length=60 type=bytes(15) offset=0 type=bytes(20) offset=15 type=bytes(10) offset=35 type=bytes(15) offset=45 Conceptual AC_No AC_Name Type Amount numeric(15) character(20) character(10) numeric(15) View 1 AC_Name Amount View 2 AC_No AC_Name Type Amount Accountholder Manager (DBMSProgrammer) Database handler User
  • 5.
    Various levels ofdatabase implementation (concept ofabstraction) 1.INTERNALLEVEL(PHYSICAL LEVEL): It describes how data are actually stored on the storage medium. It is closest to database programmer. Lowest level of database abstraction. 2. CONCEPTUAL LEVEL: It describes what data are actually stored in database. It is closest to thedatabase manager. It is an intermediate level of databaseabstraction. •EXTERNAL LEVEL(VIEW LEVEL): It describes the way in which the data are viewed by individual user. It is the level closest to the users.
  • 6.
    Item # Item- name Price I1Cake 50.00 I2 Bread 9.00 I3 Biscuits 6.00 I4 Snacks 16.00 1.Relational DataModel Supp# Supp-name S1 Britannia S2 New Bakers Supp# Item# Qty- Supplie d S1 I2 20 S1 I3 25 S1 I4 10 S2 I1 5 S2 I3 10 Table : Items Table : Suppliers Table : Shipments 1.RELATIONAL DATA MODEL: In relational data model, the data is stored in the form of tables (i.e. rows ad columns). These tables are calledrelations. The user of the relational databasesystem may insert new tuples, delete tuples, and modifytuples. DATA MODELS
  • 7.
    S1 Britannia 20 2510 I2 Bread 9.00 I3 Biscui 6.00 ts I4 Snacks 16.00 2. Network DataModel 2. NETWORK DATA MODEL: The network data model differs from the relational model.In this model data is represented by connection of records and relationships among data are represented by links.Records are organized as graphs.
  • 8.
    S1 Britannia 20 25 10 I3 I2 Bread9.00 Biscuits 6.00 I4 Snacks 16.00 3. Hierarchical DataModel 3. HIERARCHICAL DATA MODEL: Data is represented by collection of records and relationships among data by links, similar to the network model. Records are organized as trees rather than graphs. Represents relationship among its records through parent child relationships.
  • 9.
    The relational modelwas put forward by E.F. Codd of the IBM. It is considered as a very important concept in DBMS. Some basic terminologies Relation : A relation is a table i.e. data is arranged in rows and columns. Tuple : The rows of tables are generally referred to as tuples. Attributes : The columns of tables are generally referred to as attributes. Degree : The number of attributes in a relation determine the degree of the relation. Cardinality : The number of tuples in a relation is called the cardinality of the relation. Relational Data Model
  • 10.
    Normalization Normalization is asystematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain undesirable characteristics that could lead to a loss of data integrity. The objectives of normalization:  Free the database of modification anomalies  Minimize redesign when extending the database structure  Make the data model more informative to users  Avoid bias towards any particular pattern of querying In general, relational databases should be normalized to the "third normal form".
  • 11.
    Background to Normalization:Definitions Functional Dependency: If A and B are attributes of relation R, B is functionally dependent on A (denoted A  B), if each A value is associated with precisely one B value. Or in other words, In every possible legal value of R (relation), whenever two tuple agree on their A values, they also agree on their B value. Determinant of a functional dependency refers to attribute or group of attributes on left-hand side of the arrow. e.g. in an "Employee" table that includes the attributes "Employee ID" and "Employee Date of Birth", the functional dependency {Employee ID} → {Employee Date of Birth} would hold.
  • 12.
    Background to Normalization:Definitions Full Functional Dependency  A and B are attributes of a relation,  B is fully dependent on A if B is functionally dependent on A but not on any proper subset of A. A functional dependency X  Y is full functional dependency if removal of any attribute A from X means that the dependency does not hold any more.
  • 13.
    Background to Normalization:Definitions Transitive Dependency: A transitive dependency is an indirect functional dependency. Let A, B, and C designate three distinct attributes in the relation. Suppose all three of the following conditions hold:  A → B  It is not the case that B → A  B → C Then the functional dependency A → C is a transitive dependency. The functional dependency {Book} → {Author Nationality} applies; that is, if we know the book, we know the author's nationality. Furthermore:  {Book} → {Author}  {Author} → {Author Nationality}  {Author} does not → {Book} Therefore {Book} → {Author Nationality} is a transitive dependency.
  • 14.
    Background to Normalization:Definitions SuperKey: A superkey is a set of columns within a table whose values can be used to uniquely identify a row. e.g. Imagine a table with the fields <Name>, <Age>, <SSN> and <Phone Extension>. This table has many possible superkeys. Three of these are <SSN>, <Phone Extension, Name> and <SSN, Name>. Of those listed, only <SSN> is a candidate key, as the others contain information not necessary to uniquely identify records A candidate key is a key that can be used to uniquely identify record. I.e., it may be used to retrieve one specific record. The primary key of a relation is a candidate key that has been designated as the main key. A foreign key is an attribute (or collection of attributes) in a relation that can be used as a key to another relation. Foreign keys link tables together to form an integrated database.