0% found this document useful (0 votes)
17 views

Unit 1-rdbms

The document provides an overview of database system architecture, focusing on data abstraction, data independence, and the types of database management system (DBMS) architectures including 1-tier, 2-tier, and 3-tier models. It discusses data manipulation languages (DML) and data definition languages (DDL), outlining their commands and differences, as well as the entity-relationship model for database design. Additionally, it covers relational and object-oriented data models, emphasizing their structure and key concepts.

Uploaded by

9923022056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Unit 1-rdbms

The document provides an overview of database system architecture, focusing on data abstraction, data independence, and the types of database management system (DBMS) architectures including 1-tier, 2-tier, and 3-tier models. It discusses data manipulation languages (DML) and data definition languages (DDL), outlining their commands and differences, as well as the entity-relationship model for database design. Additionally, it covers relational and object-oriented data models, emphasizing their structure and key concepts.

Uploaded by

9923022056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Unit 1

Database System Architecture – Data Abstraction, Data Independence, Data


Definitions and Data Manipulation Languages. Data models – Entity Relationship
(ER), Mapping ER Model to Relational Mode, Network. Relational and Object
Oriented Data Models, Integrity Constraints and Data Manipulation Operations

DBMS Architecture

o The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers, database
servers and other components that are connected with networks.
o The client/server architecture consists of many PCs and a workstation which
are connected via the network.
o DBMS architecture depends upon how users are connected to the database to
get their request done.

Types of DBMS Architecture

Database architecture can be seen as a single tier or multi-tier. But logically, database
architecture is of two types like: 2-tier architecture and 3-tier architecture.

1-Tier Architecture

o In this architecture, the database is directly available to the user. It means the
user can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick
response.

2-Tier Architecture

o The 2-Tier architecture is same as basic client-server. In the two-tier


architecture, applications on the client end can directly communicate with the
database at the server side. For this interaction, API's like: ODBC, JDBC are
used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
o To communicate with the DBMS, client-side application establishes a
connection with the server side.

3-Tier Architecture

o The 3-Tier architecture contains another layer between the client and server. In
this architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which
further communicates with the database system.
o End user has no idea about the existence of the database beyond the application
server. The database also has no idea about any other user beyond the
application.
o The 3-Tier architecture is used in case of large web application.

Data Abstraction

Data abstraction is the process of hiding unwanted and irrelevant details from the end
user. It helps to store information in such a way that the end user can access data
which is necessary, the user will not be able to see what data is stored or how it is
stored in a database. Data abstraction helps to keep data secure from unauthorized
access and it hides all the implementation details.
There are three levels of data abstraction in DBMS that are mentioned below.
 Physical or internal level
 logical or conceptual level
 view or external level
Physical or Internal Level
 It is the lowest level of data abstraction which defines how data is stored in
database . It defines data structures used to store data and methods to access
data in database.
 It is very complex to understand and hence kept hidden from user. Database
administrator decides how and where to store the data in database.
 Physical level deals with actual storage details like data organization, disk
space allocation and data access methods.

Logical or Conceptual Level


 It is intermediate level present next to physical level. It defines what data is
present in database and their relationships between them .
 It is less complex as compared to physical level. Programmers generally work
at this level and depending on data, structure of tables, relationships and their
constraints is decided at this level.

View or External Level


 It is the highest level in abstraction. There are different levels of views and
each view defines only a part of whole data required to user.
 This level defines many views of same database for simplication of view to
user. This is the highest level and easiest to understand for user.
Advantages of data abstraction in DBMS

o Users can easily access the data based on their queries.


o It provides security to the data stored in the database.
o Database systems work efficiently because of data abstraction.

Data Independence

Types of Data Independence


There are two types of data independence.

1. logical data independence


2. Physical data independence
Logical Data Independence
 Changing the logical schema (conceptual level) without changing the external
schema (view level) is called logical data independence.
 It is used to keep the external schema separate from the logical schema.
 If we make any changes at the conceptual level of data, it does not affect the
view level.
 This happens at the user interface level.
 For example, it is possible to add or delete new entities, attributes to the
conceptual schema without making any changes to the external schema.
Physical Data Independence
 Making changes to the physical schema without changing the logical schema is
called physical data independence.
 If we change the storage size of the database system server, it will not affect the
conceptual structure of the database.
 It is used to keep the conceptual level separate from the internal level.
 This happens at the logical interface level.
 Example – Changing the location of the database from C drive to D drive.
Difference Between Physical and Logical Data Independence

Physical Data Independence Logical Data Independence

It mainly concerns how the data is It mainly concerns about changes to the
stored in the system. structure or data definition.

It is easier to achieve than logical It is difficult to achieve compared to


independence. physical independence.

To make changes at the physical level To make changes at the logical level, we
we generally do not require changes at need to make changes at the application
the application program level. level.

It tells about the internal schema. It tells about the conceptual schema.

Whenever the logical structure of


There may or may not be a need for
the database has to be changed, the
changes to be made at the internal level
changes made at the logical level are
to improve the structure.
important.

Example- change in compression


Example – adding/modifying or deleting
technology, hashing algorithm, storage
a new attribute.
device etc.

DML and DDL


(DATA MANIPULATION LANGUAGE AND DATA DEFINITION
LANGUAGE)

DDL is a Data Definition Language that is used to define data structures. For
example: creating a table, and altering a table are instructions in SQL. DML is a Data
Manipulation Language that is used to manipulate data itself. For example: insert,
update, and delete are instructions in SQL.
Data Definition Language
 DDL is used to specify a database’s structure, which includes its tables, views,
indexes, and constraints.
 DDL commands come in the following types: CREATE, ALTER, DROP,
RENAME, and TRUNCATE.
 DDL statements only modify the database’s schema; they have no direct effect
on the data within the database.
 DDL declarations are irreversible and difficult to undo.

Command Description Syntax

Create database or its


objects (table, index, CREATE TABLE table_name
CREATE function, views, store (column1 data_type, column2
procedure, and data_type, ...);
triggers)

Delete objects from


DROP DROP TABLE table_name;
the database

ALTER TABLE table_name ADD


Alter the structure of
ALTER COLUMN column_name
the database
data_type;

Remove all records


from a table,
TRUNCATE TABLE
TRUNCATE including all spaces
table_name;
allocated for the
records are removed

Add comments to the COMMENT 'comment_text' ON


COMMENT
data dictionary TABLE table_name;

Rename an object RENAME TABLE


RENAME existing in the old_table_name TO
database new_table_name;

Example of DDL
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
hire_date DATE
);

Data Manipulation Language


 Inserting, updating, removing, and retrieving data from a database are all
possible with DML.
 DML commands come in the following types: SELECT, INSERT, UPDATE,
DELETE, and MERGE.
 DML statements have a direct impact on the database’s data.
 In the event of an error, data can be recovered thanks to the reversibility of
DML statements.

Command Description Syntax

It is used to retrieve SELECT column1, column2, ...FROM


SELECT
data from the database table_name WHERE condition;

INSERT INTO table_name (column1,


INSERT Insert data into a table
column2, ...) VALUES (value1, value2, ...);

UPDATE table_name SET column1 =


Update existing data
UPDATE value1, column2 = value2 WHERE
within a table
condition;

Delete records from a DELETE FROM table_name WHERE


DELETE
database table condition;

EXAMPLE
SELECT first_name, last_name, hire_date
FROM employees
WHERE department = 'Sales'
ORDER BY hire_date DESC;

INSERT INTO employees (first_name, last_name, department)


VALUES ('Jane', 'Smith', 'HR');
Difference Between DDL and DML

DDL DML

It stands for Data Definition


It stands for Data Manipulation Language .
Language .

It is used to create database


It is used to add, retrieve, or update the
schema and can be used to define
data.
some constraints as well.

It basically defines the column It adds or updates the row of the table.
(Attributes) of the table. These rows are called tuples.

It doesn’t have any further It is further classified into Procedural and


classification. Non-Procedural DML.

Basic commands present in DDL are


BASIC commands present in DML
CREATE, DROP, RENAME,
are UPDATE , INSERT , MERGE etc.
ALTER, etc.

DDL does not use WHERE clause in While DML uses WHERE clause in its
its statement. statement.

DDL is used to define the structure DML is used to manipulate the data within
of a database. the database.

DDL is used to create and modify


DML is used to perform operations on the
database objects like tables, indexes,
data within those database objects.
views, and constraints.

DDL statements are typically


DML statements are frequently executed to
executed less frequently than DML
manipulate and query data.
statement

DDL statements are typically DML statements are typically executed by


executed by database administrators. application developers or end-users.

DDL statements are not used to DML statements are used to manipulate
manipulate data directly. data directly.
DDL DML

The database’s contents are not DML commands alter the database’s
altered by DDL commands. contents.

Examples of DDL commands:


Examples of DML commands: SELECT,
CREATE TABLE, ALTER TABLE,
INSERT, UPDATE, DELETE, and
DROP TABLE, TRUNCATE
MERGE.
TABLE, and RENAME TABLE.

ER-MODEL
The Entity Relationship Model is a model for identifying entities (like student, car or
company) to be represented in the database and representation of how those entities
are related. The ER data model specifies enterprise schema that represents the overall
logical structure of a database graphically.
Components of ER Diagram

 Entity
An Entity may be an object with a physical existence – a particular person, car, house,
or employee – or it may be an object with a conceptual existence – a company, a job,
or a university course.
Entity Set?
An Entity is an object of Entity Type and a set of all entities is called an entity set. For
Example, E1 is an entity having Entity Type Student and the set of all students is
called Entity Set. In ER diagram, Entity Type is represented as:
Types of Entity
There are two types of entity:
1. Strong Entity
 A Strong Entity is a type of entity that has a key Attribute. Strong Entity does
not depend on other Entity in the Schema. It has a primary key, that helps in
identifying it uniquely
 It is represented by a rectangle. These are called Strong Entity Types.
2. Weak Entity
 An Entity type has a key attribute that uniquely identifies each entity in the
entity set. But some entity type exists for which key attributes can’t be defined.
These are called Weak Entity types .
 A weak entity type is represented by a Double Rectangle. The participation of
weak entity types is always total. The relationship between the weak entity type
and its identifying strong entity type is called identifying relationship and it is
represented by a double diamond.

 Attributes
Attributes are the properties that define the entity type.

Types of Attributes
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the key
attribute. For example, Roll_No will be unique for each student. In ER diagram, the
key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute. For
example, the Address attribute of the student Entity type consists of Street, City, State,
and Country. In ER diagram, the composite attribute is represented by an oval
comprising of ovals.

3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a multivalued
attribute is represented by a double oval.

4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known as a
derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, the derived
attribute is represented by a dashed oval.

The Complete Entity Type Student with its Attributes can be represented as:
 RELATIONSHIP
1. One-to-One: When each entity in each entity set can take part only once in the
relationship, the cardinality is one-to-one.

Using Sets, it can be represented as:


2. One-to-Many: In one-to-many mapping as well where each entity can be related to
more than one entity and the total number of tables that can be used in this is 2. Let us
assume that one surgeon department can accommodate many doctors. So the
Cardinality will be 1 to M. It means one department has many Doctors.

Using sets, one-to-many cardinality can be represented as:

3. Many-to-One: When entities in one entity set can take part only once in the
relationship set and entities in other entity sets can take part more than once in the
relationship set, cardinality is many to one.
Using Sets, it can be represented as:

4. Many-to-Many: When entities in all entity sets can take part more than once in the
relationship cardinality is many to many.

Using Sets, it can be represented as:


Relational and Object-Oriented Data Models in RDBMS

1. Overview of Data Models in RDBMS


A Data Model in a Relational Database Management System (RDBMS) defines how
data is structured, manipulated, and managed. Two significant models include:
1. Relational Data Model (RDM): Based on mathematical set theory and
relational algebra.
2. Object-Oriented Data Model (OODM): Integrates object-oriented
programming principles with database systems.

2. Relational Data Model (RDM)


2.1 Definition
The Relational Data Model organizes data into tables (relations) with rows and
columns. Each table represents an entity, and rows correspond to individual records.
2.2 Key Concepts
 Relation/Table: A two-dimensional structure with rows (tuples) and columns
(attributes).
 Attributes: Columns in a table that define properties of the entity.
 Tuple: A single row in a table, representing an instance of the entity.
 Primary Key: A unique identifier for each tuple in a relation.
 Foreign Key: An attribute linking one table to another.
 Schema: The structure of a relation, including its attributes and data types.
 Constraints:
o Entity Integrity Constraint: Ensures primary key values are unique
and non-null.
o Referential Integrity Constraint: Maintains consistency between
foreign keys and primary keys.
2.3 Advantages
 Simplicity: Data is represented in an intuitive tabular format.
 Data Independence: Logical and physical data independence.
 Standardized Query Language: SQL allows complex queries and data
manipulation.
2.4 Limitations
 Limited support for complex data types like multimedia, spatial, and
hierarchical data.
 Poor representation of real-world relationships like inheritance.

3. Object-Oriented Data Model (OODM)


3.1 Definition
The Object-Oriented Data Model integrates database features with object-oriented
programming concepts, such as encapsulation, inheritance, and polymorphism.
3.2 Key Concepts
 Objects: Represent entities in the database, encapsulating data (attributes) and
behavior (methods).
 Classes: Define the blueprint for objects, including attributes and methods.
 Inheritance: Allows classes to derive properties and behavior from parent
classes.
 Encapsulation: Bundles data and methods into a single unit, ensuring data
integrity.
 Relationships: Use references to establish associations between objects.
 Object Identifiers (OID): Unique system-generated identifiers for objects,
independent of attribute values.
3.3 Advantages
 Rich Data Representation: Handles complex data types like images, audio,
and video.
 Inheritance and Reusability: Promotes modular and reusable design.
 Seamless Integration with Object-Oriented Languages: Facilitates
application development using object-oriented paradigms.
3.4 Limitations
 Complexity: More intricate than the relational model.
 Limited Standardization: Lacks universal standards like SQL.
 Performance: Object-oriented databases can be slower due to additional
overhead.

4. Comparison Between Relational and Object-Oriented Models

Relational Data Model Object-Oriented Data Model


Aspect
(RDM) (OODM)

Data Tables with rows and


Objects with attributes and methods
Representation columns

Established via foreign


Relationships Represented using object references
keys

Simple data types (int, Complex data types (multimedia,


Data Types
string, etc.) spatial, etc.)

Inheritance Not supported Supported

Query Language Standardized (SQL) Varies, often proprietary

Optimized for structured May have overhead due to object


Performance
queries management

5. Object-Relational Database Management Systems (ORDBMS)


To bridge the gap between RDM and OODM, Object-Relational Database
Management Systems (ORDBMS) combine the simplicity of relational models with
the power of object-oriented concepts.
Key Features of ORDBMS
 Supports user-defined data types and complex objects.
 Inherits relational concepts like tables, primary keys, and SQL.
 Adds object-oriented features like inheritance and encapsulation.

6. Conclusion
 Relational Data Models are best suited for structured and straightforward data
applications.
 Object-Oriented Data Models excel in handling complex and multimedia
data.
 The choice of data model depends on the application’s requirements, balancing
simplicity, performance, and the complexity of the data.

You might also like