Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ITNMT REVIEWER MIDTERM  Security − Features like multiple views

offer security to some extent where


SESSION 2 users are unable to access data of other
users and departments.
A database is an organized collection of data,
generally stored and accessed electronically
from a computer system. POPULAR DBMS

Database System - Composed of 5 major parts: Server DBMS


Hardware, Software (DBMS), People,
Procedures and Data Oracle , SQL Server , DB2 , MySQL, Firebird,
PostgreSQL, (Significant open source DBMS)
CHARACTEISTICS OF DBMS
Desktop DBMS
 Real-world entity − A modern DBMS is
Microsoft Access, FoxPro, Paradox, Approach,
more realistic and uses real-world
FileMaker Pro
entities to design its architecture. It
uses the behavior and attributes too. USERS

 Relation-based tables − DBMS allows  Administrators-Administrators


entities and relations among them to maintain the DBMS and are responsible
form tables. A user can understand the for administrating the database.
architecture of a database just by
looking at the table names.  Designers − Designers are the group of
people who actually work on the
 Less redundancy − DBMS follows the designing part of the database.
rules of normalization, which splits a
relation when any of its attributes is  End Users − End users are those who
having redundancy in values. actually reap the benefits of having a
Normalization is a mathematically rich DBMS.
and scientific process that reduces data
redundancy. DBMS ARCHITECTURE

 The design of a DBMS depends on its


 Consistency − Consistency is a state
architecture. It can be centralized or
where every relation in a database
decentralized or hierarchical.
remains consistent. There exist
methods and techniques, which can  DBMS architecture depends upon how
detect attempt of leaving database in users are connected to the database to
inconsistent state. get their request done.

 The architecture of DBMS depends on


 Query Language − DBMS is equipped
with query language, which makes it the computer system on which it runs
more efficient to retrieve and
manipulate data. A user can apply as DBMS ARCHITECTURE
many and as different filtering options
as required to retrieve a set of data 1 TIER ARCHITECTURE

It is where the Client, Server, and Database all


reside on the same machine.

 Multiuser and Concurrent Access − NOTE:


DBMS supports multi-user environment
and allows them to access and Anytime you install a DB in your system and
manipulate data in parallel. access it to practice SQL queries it is 1 tier
architecture.
 Multiple views − DBMS offers multiple
views for different users. A user who is
in the Sales department will have a 2 TIER ARCHITECTURE
different view of database than a
The Database system is present at the server
person working in the Production
machine and the DBMS application is present at
department.
the client machine, these two machines are
connected with each other through a reliable
network.
3 TIER ARCHITECTURE 2 TYPES OF DATABASE INDEPEDENCE

This DBMS architecture contains an Application Logical Data Independence


layer between the user and the DBMS, which is
responsible for communicating the user's  Refers characteristic of being able to
request to the DBMS system and send the change the conceptual schema without
response from the DBMS to the user. having to change the external schema.

3 LEVEL SCHEMA ARCHITECTURE  Logical data independence is used to


separate the external level from the
The term "schema" refers to the organization of
conceptual view
data as a blueprint of how the database is
constructed. Physical Data Independence

EXTERNAL(VIEW) LEVEL  The capacity to change the internal


schema without having to change the
 Several users can view their desired
conceptual schema.
data from this level which is internally
fetched from database with the help of
 Physical data independence is used to
conceptual and internal level mapping.
separate conceptual levels from the
 External level is the “top level” of the
internal levels.
Three Level of Schema Architecture.

CONCEPTUAL(LOGICAL) LEVEL
SESSION 3
It is also called logical level. The whole design of
the database such as relationship among data, A data model is a collection of concepts for
schema of data etc. are described in this level. describing data in a database, including:

INTERNAL(PHYSICAL) LEVEL  Objects

This level is also known as physical level. This  Relationships among objects
level describes how the data is actually stored
in the storage devices. This level is also  Constraints on objects & relationships
responsible for allocating space to the data. This
 Operations on objects & relationships
is the lowest level of the architecture.
Data modeling helps in the visual
Physical level these records can be described as
representation of data.
blocks of storage (bytes, gigabytes, terabytes
etc.) in memory. These details are often hidden Data modeling is typically done in three phases
from the programmers.  Conceptual design

Logical level these records can be described as  Logical design


fields and attributes along with their data types,
their relationship among each other can be  Physical design
logically implemented.
A conceptual data model identifies the
View level, user just interact with system with highestlevel relationships between the different
the help of GUI and enter the details at the entities.
screen, they are not aware of how the data is
Features of conceptual data model include:
stored and what data is stored; such details are
hidden from them.  Includes the important entities and the
relationships among them.
Database schema is the skeleton of database. It
is designed when the database doesn't exist at  No attribute is specified.
all.
 No primary key is specified.
INSTANCE OF DATABASE is the data stored in
database at a particular moment of time is
called.
A logical data model describes the data in as
Data independence refers characteristic of much detail as possible, without regard to how
being able to modify the schema at one level of they will be physical implemented in the
the database system without altering the database.
schema at the next higher level.
An entity that depends on another entity called
a weak entity.
Features of a logical data model include:
The weak entity doesn't contain any key
 Includes all entities and relationships among attribute of its own. The weak entity is
them. represented by a double rectangle
 All attributes for each entity are specified.

 The primary key for each entity is specified. ATTRIBUTE

 Foreign keys are specified. The attribute is used to describe the property
of an entity. Ellipse is used to represent an
 Normalization occurs at this level.
attribute

Physical data model represents how the model


KEY ATTRIBUTE
will be built in the database.
The key attribute is used to represent the main
Features of a physical data model include:
characteristics of an entity.
 Specification all tables and columns.
It represents a primary key. The key attribute is
 Foreign keys are used to identify represented by an ellipse with the text
relationships between tables. underlined

 Denormalization may occur based on user


requirements.
COMPOSITE ATTRIBTE
 Physical considerations may cause the
An attribute that composed of many other
physical data model to be quite different from
attributes is known as a composite attribute.
the logical data model.
The composite attribute is represented by an
 Physical data model will be different for ellipse, and those ellipses are connected with
different RDBMS. an ellipse.

ER MODEL
Entity-Relationship Model or E-R Model was MULTIVALUED ATTRIBUTE
developed by Peter Chen in 1976.
An attribute can have more than one value.
E-R Model can be expressed as the collection of These attributes are known as a multivalued
entities, also called as real word objects and attribute.
relations between those entities. No two
entities should be identical. The double oval is used to represent
multivalued attribute.
The database structure is portrayed as a
diagram called an entity-relationship diagram.
DERIVED ATTRIBUTE

An attribute that can be derived from other


attribute .

It can be represented by a dashed ellipse

RELATIONSHIP

ENTITY -used to describe the relation between entities.

An entity may be any object, class, person or Diamond or rhombus is used to represent the
place. In the ER diagram, an entity can be. relationship.
represented as rectangles
When only one instance of an entity is CODD’S 12 RULES
associated with the relationship, then it is
known as one to one relationship  E.F Codd was a Computer Scientist who
invented the Relational model for Database
When only one instance of the entity on the management. Based on relational model, the
left, and more than one instance of an entity on Relational database was created.
the right associates with the relationship then
this is known as a one-to-many relationship.  Codd proposed 13 rules popularly known as
Codd's 12 rules to test DBMS's concept against
When more than one instance of the entity on his relational model.
the left, and only one instance of an entity on
the right associates with the relationship then it  Codd's rule actually define what quality a
is known as a many-to-one relationship. DBMS requires in order to become a Relational
Database Management System(RDBMS).
When more than one instance of the entity on
the left, and more than one instance of an RELATIONAL MODEL CONCEPTS
entity on the right associates with the
1. Table / Relation
relationship then it is known as a many-to-
many relationship. 2. Tuple / Record

NOTATION OF ERD 3. Attribute / Column / Field

Database can be represented using the 4. Relation key


notations. In ER diagram, many notations are
used to express the cardinality. These notations 5. Attribute domain
are as follows: 6. Relation Schema
 Information Engineering Style 7. Relation instance
 Chen Style Relational model the, relations are saved in the
table format. It is stored along with its entities.
 Bachman
RELATIONAL MODEL CONCEPTS
 Martin Style
A TABLE has two properties rows and columns.
Rows represent records and columns represent
attributes.

TUPLE - a single row of a table, which contains a


single record.

ATTRIBUTE- Each column in a Table. Attributes


are the properties which define a relation.

ATTRIBUTE DOMAIN- A domain is a set of


permitted values for an attribute in table. An
attribute cannot accept values that are outside
of their domains.

RELATION SCHEMA - represents the name of


the relation with its attributes.

RELATION INSTANCE - is a finite set of tuples in


the RDBMS system. Relation instances never
have duplicate tuples.
SESSION 4
RELATION KEY - Every row has one, two or
RELATIONAL MODEL multiple attributes. It is an attribute which can
uniquely identify a particular tuple(row) in a
is the primary data model, which is used widely
relation(table)
around the world for data storage and
processing.

The relational model represents the database as


a collection of relations. A relation is nothing
but a table of values.
KEYS OTHER KEYS

plays an important role in relational database; it Alternate Key – Out of all candidate keys, only
is used for identifying unique rows from table. It one gets selected as primary key, remaining
also establishes relationship among tables. keys are known as alternate or secondary keys.

TYPES OF KEYS Composite Key – A key that consists of more


than one attribute to uniquely identify rows
SUPER KEY (also known as records & tuples) in a table is
 is defined as a set of attributes within a called composite key.
table that can Non – Key - attributes are the attributes or
uniquely identify each record within a fields of a table, other than candidate key
table. attributes/fields in a table.

 Super Key is a superset of Candidate


key.
CONSTRAINTS
TABLE: EMPLOYEE
Every relation has some conditions that must
 EM_ID, EM_PhilHealthNum, EM_phoneNum, hold for it to be a valid relation. These
EM_Bday, {EM_ID, EM_name}, {EM_ID, conditions are called Relational Integrity
EM_PhilHealthNum}, {EM_PhilHealthNum, Constraints.
EM_name}
There are three main integrity constraints

Key constraints
CANDIDATE KEY
An attribute that can uniquely identify a tuple in
 is a minimal super key with no a relation is called the key of the table.
redundant attributes. It is a super key
Key constraints force that:
with no redundant attributes
 In a relation with a key attribute, no two
 EM_ID, EM_PhilHealthNum
tuples can have identical values for key
attributes.

PRIMARY KEY  A key attribute can not have NULL values

 A Primary key is a column or set of


columns in a table that uniquely
Domain constraints
identifies tuples (rows) in that table. It
is selected from a set of candidate keys. can be violated if an attribute value is not
appearing in the corresponding domain or it is
 This is done by database admin or not of the appropriate data type.
database designer. EM_ID or
EM_PhilHealthNum can be chosen as a  Domain constraints specify that within each
primary tuple, and the value of each attribute must be
unique.

FOREIGN KEY

 are the columns of a table that points to Referential integrity constraints


the primary key of another table
is base on the concept of Foreign Keys.
.
 They act as a cross-reference between  A foreign key is an important attribute of a
tables relation which should be referred to in other
relationships.
 AR_ID is the primary key of the
AIRLINES Relation  Referential integrity constraint state happens
where relation refers to a key attribute of a
different or same relation. However, that key
element must exist in the table
QUERY LANGUAGE  Duplicate tuples are automatically
eliminated.
Relational database systems are expected to be
equipped with a query language that can assist EXAMPLE: ∏ AR_company (AIRLINES) ∪ ∏
its users to query the database instances. AR_company (TRANSACTION)

There are two kinds of query languages

 Relational Algebra – Procedural Set Intersection

 is a procedural query language used to  Suppose there are two tuples R and S.
query the database tables to access  The set intersection operation contains
data in different ways. all tuples that are in both R & S.
 It is denoted by intersection ∩.
 works on the whole table at once, so  Notation: R ∩ S
we do not have to use loops etc. to
EXAMPLE: ∏ AR_company (AIRLINES) ∩ ∏
iterate over all the rows(tuples) of data
AR_company (TRANSACTION)
one by one.

 It uses operators to perform queries. An


operator can be either unary or binary Set Different

 Suppose there are two tuples R and S.


The primary operations that we can perform  The set intersection operation contains
using relational algebra are: all tuples that are in R but not in S.
 It is denoted by intersection minus (-).
Select  Notation: R – S

 Select Operator is denoted by sigma (σ) EXAMPLE: ∏ AR_company (AIRLINES) - ∏


and it is used to find the tuples (or AR_company (TRANSACTION)
rows) in a relation (or table) which
satisfy the given condition.
 Notation: σ Condition (Relation/Table
Cartesian product
name)
 The Cartesian product is used to
EXAMPLE: σ AR_address = “Cebu” (Airlines)
combine each row in one table with
each row in the other table.
 It is also known as a cross product.
Project  It is denoted by X.
 Notation: E X D
 Project operator is denoted by ∏
symbol and it is used to select desired EXAMPLE: AIRLINES X AIRCRAFT
columns from a table
 Notation: ∏ column_name1, ..
column_nameN(table_name)
Rename
EXAMPLE: ∏ AR_ID, AR_company (Airlines)
 Rename (ρ) operation can be used to
rename a relation or an attribute of a
relation.
Union  It is denoted by rho (ρ).
 Notation: ρ(OLD NAME, NEW NAME)
 Union operator is denoted by ∪ symbol
 EX: ρ(AIRCRAFT, AIRPLANE)
and it is used to select all the rows
(tuples) from two tables (relations).
 Notation − r U s Where r and s are
either database relations or relation  Relational Calculus – Non Procedural
result set (temporary relation).
 In contrast to Relational Algebra,
A union operation must hold the following Relational Calculus is a non-procedural
condition: query language, that is, it tells what to
do but never explains how to do it.
 r, and s must have the same number of
attributes.
 Attribute domains must be compatible.
 It tells the system what data to be
retrieved but doesn’t tell how to
retrieve it.

Relational calculus exists in two forms:

Tuple Relational Calculus (TRC)

 Tuple relational calculus is used for


selecting those tuples that satisfy the
given condition.
 Notation: {T | P (T)} or {T | Condition
(T)} Where
 T is the resulting tuples
 P(T) is the condition used to fetch T.

EXAMPLE:{ T.AC_MODEL | AIRCRAFT(T) AND


T.AC_CAPACITY > 320}

Domain Relational Calculus (DRC)

 In domain relational calculus the


records are filtered based on the
domains.
 The filtering variable uses the domain of
attributes instead of entire tuple values
 It uses logical connectives ∧ (and), ∨
(or) and ┓ (not).
 It uses Existential (∃) and Universal
Quantifiers (∀) to bind the variable.
 Notation: { a1, a2, a3, ..., an | P (a1, a2,
a3, ... ,an)} Where a1, a2 are attributes
P stands for formula built by inner
attributes

EXAMPLES: {< AR_company, TR_DATE,


TR_AMOUNT > | ∈ TRANSACTION ∧ TR_DESC =
‘Tickets’}

You might also like