2. DBMS RDBMS
DBMS फ़ाइल के रूप में डेटा को सेव करता है RDBMS डाटा को टेबल में सेव करता है
एक बार मे केवल एक ही डेटा एलिमेंट्स को एक्सेस किया
जाता है
Multiple data elements can be एक साथ कई डेटा
एलीमेंट को एक्सेस किया जा सकता है
एक डेटा एलिमेंट का दूसरे डेटा एलिमेंट से कोई सम्बन्ध
नही होता है
इसमे डेटा टेबल के फॉर्म में सेव होतें हैं जो कि एक दूसरे से
related होतें हैं।
Normalization नहीं होता है Normalization होता है
DBMS डिस्ट्रिब्यूटेड डेटा को सपोर्ट नहीं करता है RDBMS डिस्ट्रिब्यूटेड डेटा को सपोर्ट करता है
यह डेटा को navigational या hierarchical फॉर्म में सेव
करता है
यह डेटा को सेव करने के लिए tabular फॉर्म का उपयोग
करता है
यह छोटे डेटा को हैंडल करने के लिए यूज़ किया जाता है यह बहुत ज्यादा डेटा को हैंडल करने के लिए यूज़ किया है
Data redundancy(अनावश्यक) इसमे एक आम बात है Keys और index में डेटा redundancy नहीं होती है
यह छोटे आर्गेनाइजेशन
के में यूज़ होता है
यह बड़े आर्गेनाइजेशन में यूज़ किया जाता है जहाँ बहुत
ज्यादा डेटा को हैंडल करना होता है
single यूजर को सपोर्ट करता है यह मल्टीयूज़र को सपोर्ट करता है
बड़े डेटा को fetch करने में बहुत समय लगता है इसमे डेटा fetching DBMS से तेज होतीहै
डेटा manipulation के लिए low सिक्योरिटी लेवल होता है RDBMS में मल्टिपल लेवल की सिक्योरिटी होती है
Low software और hardware की आवश्यकता होती है Higher software और hardware की आवश्यकता होती है
Examples: XML, Microsoft Access, etc.
Examples: MySQL, PostgreSQL, SQL Server, Oracle,
etc.
3. DBMS RDBMS
DBMS फ़ाइल के रूप में डेटा को सेव करता है RDBMS डाटा को टेबल में सेव करता है
एक बार मे केवल एक ही डेटा एलिमेंट्स को एक्सेस किया
जाता है
Multiple data elements can be एक साथ कई डेटा
एलीमेंट को एक्सेस किया जा सकता है
एक डेटा एलिमेंट का दूसरे डेटा एलिमेंट से कोई सम्बन्ध
नही होता है
इसमे डेटा टेबल के फॉर्म में सेव होतें हैं जो कि एक दूसरे से
related होतें हैं।
Normalization नहीं होता है Normalization होता है
DBMS डिस्ट्रिब्यूटेड डेटा को सपोर्ट नहीं करता है RDBMS डिस्ट्रिब्यूटेड डेटा को सपोर्ट करता है
यह डेटा को navigational या hierarchical फॉर्म में सेव
करता है
यह डेटा को सेव करने के लिए tabular फॉर्म का उपयोग
करता है
यह छोटे डेटा को हैंडल करने के लिए यूज़ किया जाता है यह बहुत ज्यादा डेटा को हैंडल करने के लिए यूज़ किया है
Data redundancy(अनावश्यक) इसमे एक आम बात है Keys और index में डेटा redundancy नहीं होती है
यह छोटे आर्गेनाइजेशन
के में यूज़ होता है
यह बड़े आर्गेनाइजेशन में यूज़ किया जाता है जहाँ बहुत
ज्यादा डेटा को हैंडल करना होता है
single यूजर को सपोर्ट करता है यह मल्टीयूज़र को सपोर्ट करता है
बड़े डेटा को fetch करने में बहुत समय लगता है इसमे डेटा fetching DBMS से तेज होतीहै
डेटा manipulation के लिए low सिक्योरिटी लेवल होता है RDBMS में मल्टिपल लेवल की सिक्योरिटी होती है
Low software और hardware की आवश्यकता होती है Higher software और hardware की आवश्यकता होती है
Examples: XML, Microsoft Access, etc.
Examples: MySQL, PostgreSQL, SQL Server, Oracle,
etc.
5. RDBMS
Relational database management system.
Data is stored in the form of tables and there is a
relationship between these tables.
6. DATA MODELS
Data Model can be defined as an integrated
collection of concepts for describing and
manipulating data, relationships between data,
and constraints on the data in an organization.
It is used for representing entities of interest
and their relationships in database.
डेटा मॉडल को किसी संगठन में डेटा का वर्णन और हेरफे र करने,
डेटा के बीच संबंधों और डेटा पर बाधाओं के लिए अवधारणाओं के एक एकीकृत
संग्रह के रूप में परिभाषित किया जा सकता है।
इसका उपयोग डेटाबेस में रुचि की संस्थाओं और उनके संबंधों का प्रतिनिधित्व
करने के लिए किया जाता है।
7. TYPES OF DATA MODELS
Record-based data model
Object- based data model
Physical data model
8. RECORD BASED DATA
MODELS
Record based data models specify the overall logical
structure of the database and provides a higher-level
description of the implementation.
Record based models are so named because the
database is structured in fixed format records of
several types.
The three most widely accepted record based data
models are:
• Hierarchical Model
• Network Model
• Relational Model
9. OBJECT BASED MODELS
Object–based data models are used to describe data
and its relationships.
It uses concepts such as entities, attributes and
relationships.
Following are the common types of object-based data
models:
• Entity-Relationship
• Object Oriented
• Semantic
• Functional
10. PHYSICAL DATA MODELS
Physical data models describe how data is stored
in the computer, representing information such
as record structures, record ordering, and access
paths.
Two types of physical data models are:
• Unifying model
• Frame memory model
11. HIERARCHICAL DATA
MODEL
A hierarchical database model is a data model
in which the data is organized into a tree-like
structure. The data is stored as records which
are connected to one another through links.
E.g.
University
Department
Faculty
12. NETWORK DATA MODEL
This model is same as hierarchical model, except
that a record can have multiple parents.
Network model has three basic components-
record type , data items and links.
13. RELATIONAL DATA MODEL
Relational model stores data in the form of tables.
The relational model consists of three major
components:
The set of relations and set of domains that
defines the way data can be represented (data
structure).
Integrity rules that define the procedure to protect
the data (data integrity).
The operations that can be performed on data
(data manipulation).
16. ER MODELLING
The ER model is a conceptual data model
that views the real world as entities and
relationships.
A basic component of the model is the
Entity-Relationship diagram, which is used
to visually represent data objects.
Entity relationship model defines the
conceptual view of database.
17. BASIC CONCEPTS IN ER
MODEL
An entity is an object that exists and is distinguishable
from other objects.
◦ Example: specific person, company, event, plant
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
Entities have attributes- simple attributes, composite
attributes, derived attributes, single-valued attributes etc.
◦ Example: people have names and addresses
A relationship A Relationship represents an association
between two or more entities. Relationships are classified
in terms of degree, connectivity, cardinality, and
existence.
18. DEGREE OF RELATIONSHIP- The number of participating
entities in an relationship defines the degree of the relationship.
Unary = degree 1
Binary = degree 2
Ternary = degree 3
employee manager-of employee is unary
employee works-for department is binary
customer purchase item, shop keeper is a ternary
relationship
MAPPING CARDINALITIES:
Cardinality defines the number of entities in one entity set
which can be associated to the number of entities of other set
via relationship set..
19. One-to-one: one entity from entity set A can be
associated with at most one entity of entity set B and vice
versa
One-to-many: One entity from entity set A can be
associated with more than one entities of entity set B but
from entity set B one entity can be associated with at
most one entity.
20. Many-to-one: More than one entities from entity set A
can be associated with at most one entity of entity set B
but one entity from entity set B can be associated with
more than one entity from entity set A.
Many-to-many: one entity from A can be associated
with more than one entity from B and vice versa.
23. EXTENDED ER FEATURES
Specialization: Top-down design process.
Specialization is the process of taking subsets of a
higher-level entity set to form lower level entity sets. It
is a process of defining a set of subclasses of an entity
type, which is called as superclass of the specialization.
For example, specialization of the Employee entity type
may yield the set of subclasses namely
Salaried_Employee and Hourly_Employee on the
method of pay
24. Generalization: A bottom-up design process
A generalization hierarchy is a form of abstraction that
specifies that two or more entities that share common
attributes can be generalized into a higher-level entity
type called a super type or generic entity. The lower
level of entities becomes the subtype, or categories, to
the super type. Subtypes are dependent entities.
Generalization is denoted through a triangle component
labeled ‘IS A”.
25. Aggregation
One limitation of the E-R model is that it cannot express
relationships among relationships.
The best way to model a situation like this is by the use
of aggregation.
26. NORMALIZATION
Normalization is a process of decomposing a set of
relations with anomalies to produce smaller and well
structured relations that contain minimum or no
redundancy.
It is a formal process of deciding which attributes should
be grouped together in a relation.
The process of normalization can be defined as the
procedure of successive reduction of a given collection
of relational schemas based on their FD’s and primary
keys to achieve some desirable form of minimized
redundancy.
27. NORMAL FORMS
First normal form (1NF)
Second normal form (2NF)
Third normal form (3NF)
Boyce/ Codd normal form (BCNF)
Fourth normal form (4NF)
Fifth normal form (5NF)
28. LOGICAL DATABASE
DESIGN
The logical design is more conceptual and abstract than the
physical design.
In the logical design, you look at the logical relationships among
the objects. In the physical design, you look at the most effective
way of storing and retrieving the objects.
The process of logical design involves arranging data into a series
of logical relationships called entities and attributes.
An entity represents a chunk of information. In relational
databases, an entity often maps to a table. An attribute is a
component of an entity and helps define the uniqueness of the
entity. In relational databases, an attribute maps to a column.
You can create the logical design using a pen and paper, or you
can use a design tool such as Oracle Warehouse Builder or Oracle
Designer.
29. SQL (Structured Query
Language)
SQL is a relational the query language.
It is the standard command set used to
communicate with the relational
database management system (RDBMS).
It is a non-procedural language.
SQL is both data definition language and
data manipulation language.
30. COMPONENTS OF SQL
Data structure.
Data type.
SQL operators.
Data definition language (DDL)
Data query language (DQL)
Data manipulation language (DML)
Data control language (DCL)
Data administration statements (DAS)
Transaction control statements (TCS)
31. ADVANTAGES AND
DISADVANTAGES
Advantages:
very flexible , free-format syntax.
Supported by every product.
It can express arithmetic operations as well as
operations to aggregate data and sort data for
output.
Disadvantages:
It is not a general-purpose programming language
and thus the development of an application requires
the use of a SQL with a programming language.
32. DDL(Data Definition
Language)
DDL is a special language used to specify a
database conceptual schema using set of
definitions. It supports the definitions or
declaration of objects.
Create
Alter
Drop
Truncate
33. DML(Data Manipulation
Language)
DML is a mechanism that provides a set of
operations to support the basic data
manipulation operations on the data.
It is used to retrieve data stored in a database,
express database queries and updates . It helps
in communicating with DBMS.
Insert
Update
Delete
Select
34. DCL (Data Control Language)
DCL statements are used to control access to
data stored in a database.
Commands of DCL are:
Grant
Revoke
Commit
Rollback
35. SQL JOINS
SQL join is used for combining column from
two or more tables by using values common to
both tables.
Join keyword is used in SQL queries for joining
tables.
Minimum required condition is ,(n-1).
A table can also join to itself known as, Self Join
37. Cartesian Product: Returns All rows from first
table, Each row from the first table is combined
with all rows from the second table.
Inner join : is the Cartesian product that
satisfies the join condition in the WHERE
clause.
Equi join : In this join , where clause is based
on the equality condition “=“. Hence it is called
equi join.
38. Outer Join: Retrieve all rows that match the
WHERE clause and also those that have a
NULL value in the column used for join.
Left outer joins include all records from the first
(left) of two tables,
A = B (+)
Right outer joins include all records from the
second (right) of two tables,
A (+) = B
39. SUB QUERIES
Queries inside the main query.
Sub queries are used to structure the queries.
In many cases, a sub query can be used instead
of a JOIN (and vice versa)
e.g Select cust_ID, Loan_no
From Customer_Loan
Where amount_in_dollars >
(Select amount_in_dollars
From Customer_Loan
Where Cust_ID = 104);
40. VIEWS
A view is a kind of “virtual table”.
Views are tables whose contents are taken or
derived from other tables.
To the user, the view appears like a table with
columns and rows. But in reality, the view
doesn’t exists in the database as a stored set of
values
View is like a window through which we see a
limited region of the actual table
The table from where the actual data is obtained
is called the source table
41. We can use views in select statements like.
Select * from view_employees where age > 23;
Create a view
e.g.CREATE VIEW ViewCustomerDetails
AS SELECT *FROM Customer_Details;
42. TYPES OF VIEWS
Horizontal views- Horizontal view restricts a user’s
access to only selected rows of a table.
Vertical views - A view which selects only few
columns of a table, Vertical view restricts a user’s access
to only certain columns of a table
Row/column subset views –
e.gCREATE VIEW View_Cust_VertHor
AS SELECT Cust_Id,Account_No,Account_Type
FROM Customer_Details
WHERE CUST_ID IN (101,102,103);
43. Grouped views-The query contains a group by clause
e.g CREATE VIEW View_GroupBY(Dept,NoofEmp)
AS SELECT Department, count(Employee_ID)
FROM Employee_Manager
GROUP BY Department;
Joined views- Created by specifying a two-table or
three-table query in the view creation command
e.g. Create view View_Cust_Join as
Select a.Cust_Id,b.Cust_First_Name,b.Cust_Last_Name,
Amount_in_dollars
from Customer_loan a, customer_details b
where a.cust_id = b.cust_id;
44. DATABASE DESIGN ISSUES
Poor or missing documentation for
database(s) in production
Little or no normalization
Not treating the data model like a living,
breathing organism
Improper storage of reference data
Not using foreign keys or check constraints
Not using domains and naming standards
Not choosing primary keys properly