DBMS Ggi
DBMS Ggi
• Data: Facts, figures, statistics etc. having no particular meaning (e.g. 1, ABC, 19
etc).
• Record: Collection of related data items, e.g. in the above example the three data
items had no meaning. But if we organize them in the following way, then they
collectively represent meaningful information.
The columns of this relation are called Fields, Attributes or Domains. The rows are called
Tuples or Records.
iNurture Education Solutions Pvt. Ltd.
(Introduction to RDBMS)
Schema: It means arrangement – how we want to arrange things that we have to store.
The diagram above shows the three different schemas used in DBMS, seen from different
levels of abstraction.
Instance: the actual content of the database at a particular point in time
iNurture Education Solutions Pvt. Ltd.
Three Views of Data…..contd
• The lowest level, called the Internal or Physical schema, deals with
the description of how raw data items (like 1, ABC, KOL, H2 etc.)
are stored in the physical storage (Hard Disc, CD, Tape Drive etc.).
• It also describes the data type of these data items, the size of the
items in the storage media, the location (physical address) of the
items in the storage device and so on.
• This schema is useful for database application developers and
database administrator.
Physical Data Independence: This means that for any change made in
the physical schema, the need to change the logical schema is
minimal. This is practically easier to achieve.
Logical Data Independence: This means that for any change made in
the logical schema, the need to change the external schema is
minimal. As we shall see, this is a little difficult to achieve.
• Primary Key
Primary key is a candidate key that is most appropriate to become main key of
the table. It is a key that uniquely identify each record in a table. PK must be
unique and Not Null.
• Foreign Key
Foreign Key is a field or set of fields that are identical to a primary key in
another table.
• Composite Key
Key that consist of two or more attributes that uniquely identify
an entity occurance is called Composite key. But any attribute
that makes up the Composite key is not a simple key in its own.
• Secondary or Alternative key
The candidate key which are not selected for primary key are
known as secondary keys or alternative keys
• Non-key Attribute
Non-key attributes are attributes other than candidate
key attributes in a table.
• Non-prime Attribute
Non-prime Attributes are attributes other than Primary
attribute.
• Primary Key
Customers
To aid in the development of a sound database design that does not allow anomalies
or inconsistencies
Goal: to create database tables that do not contain duplicate data values that can
become inconsistent
• Distinction
• The database schema changes very infrequently. The database state changes
every time the database is updated.
• Schema is also called intension, whereas state is called extension.
• Advantages
• Many of the hierarchical data model’s features formed the
foundation for current data models
• Its database application advantages are replicated,
implemented in a different form, in current database
environments
• Generated a large installed (mainframe) base, created a
pool of programmers who developed numerous tried-and-
true business applications
• Disadvantages
• Complex to implement
• Difficult to manage
• Lacks structural independence
• Implementation limitations
• Lack of standards iNurture Education Solutions Pvt. Ltd.
Network Model: Graph
• Advantages
• Represent complex data relationships more effectively
• Improve database performance
• Impose a database standard
• Disadvantages
• Too cumbersome
• The lack of ad hoc query capability put heavy pressure on programmers
• Any structural change in the database could produce havoc in all application
programs that drew data from the database
• Many database old-timers can recall the interminable information delays
ER Model is based on −
Entities and their attributes.
Relationships among entities.
• Entity − An entity in an ER Model is a real-world entity having properties
called attributes. Every attribute is defined by its set of values called domain.
For example, in a school database, a student is considered as an entity. Student
has various attributes like name, age, class, etc.
• Relationship − The logical association among entities is called relationship.
Relationships are mapped with entities in various ways. Mapping cardinalities
define the number of association between two entities.
• An entity set is a set of entities of the same type that share the same properties.
Example: set of all persons, companies, trees, holidays
iNurture Education Solutions Pvt. Ltd.
Entity-Relationship Model..contd
Types of Attributes
• Simple attribute − Simple attributes are atomic values, which cannot be divided
further. For example, a student's phone number is an atomic value of 10 digits.
• Composite attribute − Composite attributes are made of more than one simple
attribute. For example, a student's complete name may have first_name and
last_name.
• Derived attribute − Derived attributes are the attributes that do not exist in the
physical database, but their values are derived from other attributes present in the
database. For example, average_salary in a department should not be saved directly
in the database, instead it can be derived. For another example, age can be derived
from data_of_birth.
• number, email_address, etc.
Types of Attributes
• Single-value attribute − Single-value attributes contain single value.
• For example − Social_Security_Number.
• Multi-value attribute − Multi-value attributes may contain more than one values.
For example, a person can have more than one phone
Mapping Cardinalities
Cardinality defines the number of entities in one entity set, which can be associated
with the number of entities of other set via relationship set.
• Express the number of entities to which another entity can be associated via a
relationship set.
• Most useful in describing binary relationship sets.
• Many-to-many − One entity from A can be associated with more than one entity
from B and vice versa
• Many-to-one − More than one entities from entity set A can be associated with at
most one entity of entity set B, however an entity from entity set B can be
associated with more than one entity from entity set A.