Unit 1-rdbms
Unit 1-rdbms
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.
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
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.
Data Independence
It mainly concerns how the data is It mainly concerns about changes to the
stored in the system. structure or data definition.
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.
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.
Example of DDL
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
hire_date DATE
);
EXAMPLE
SELECT first_name, last_name, hire_date
FROM employees
WHERE department = 'Sales'
ORDER BY hire_date DESC;
DDL DML
It basically defines the column It adds or updates the row of the table.
(Attributes) of the table. These rows are called tuples.
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 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.
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.
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.
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.