Dbms 1
Dbms 1
in dbms
Because in some cases, just connecting entities isn’t enough — you may need to add more
information to the relationship itself or link it to another entity.
Scenario:
We cannot directly relate Project to just Professor or Student — because the project depends on
their relationship (who is guiding whom).
A Lossless Join is a property of database decomposition where no information is lost when you
split a relation (table) into two or more smaller relations and then rejoin them using a natural join
or equijoin.
When designing databases using Normalization, we often split tables to reduce redundancy. But
while doing this, we must ensure:
No data is lost.
Specialization is the process of dividing a higher-level entity into two or more lower-level sub-
entities based on some distinct characteristics.
It is a top-down approach.
_____________
| Employee |
|-------------|
| EmpID |
| Name |
| Salary |
___________|___________
| |
_________ __________
| Engineer | | Manager |
|----------| |----------|
| TechSkill| | TeamSize |
Example:
Engineer
Manager
Q.State and explain the components of an E-R model. in dbms
1. Entity
Definition: An object or thing in the real world that can be identified distinctly.
Types:
2. Attributes
Types:
3. Entity Set
4. Relationship
Types:
What is an ER Diagram?
It is mainly used during the design phase of a database to organize and structure data clearly.
/ \ / \
| |
(PK) (PK)
Binary Relationship
Ternary Relationship
Used when a relationship cannot be broken down into simpler binary relationships without losing
information.
Specialization
Top-down approach.
Useful when you want to distinguish entities based on some specific attribute or behavior.
Generalization
Definition: It is the process of combining two or more entities into a generalized superclass.
Bottom-up approach.
Focuses on identifying common features among entities to group them into a single entity
tuple, also known as a record or row, is a basic unit of data in a relational database management
system (DBMS). A tuple represents a single instance of a relation, or table, in the database. Each
tuple contains a set of values, or attributes, that correspond to the columns, or fields, of the
relation. E.F.
Q.List all DDL commands. Explain any two DDL Commands with example in dbms
DDL stands for Data Definition Language. It's a set of SQL commands used to create, modify, and
delete database objects such as tables, indexes, and views. The main DDL commands include:
CREATE, ALTER, DROP, TRUNCATE, and COMMENT.
. CREATE TABLE:
Syntax:
...
);
ALTER TABLE:
Purpose: Modifies the structure of an existing table. This can include adding, modifying, or
deleting columns, constraints, or even renaming the table.
DBMS, dependency preservation ensures that when decomposing a relational schema (a set of
tables), all functional dependencies present in the original schema are also preserved in the
decomposed schemas. This means that constraints defined by those dependencies can still be
enforced after decomposition. Dependency preservation is crucial for maintaining data integrity
and avoiding anomalies that can arise from losing dependencies during decomposition.
FDs define relationships between attributes within a relation. For example, if A -> B means that the
value of attribute A determines the value of attribute B.
Q.Write a short note on data independence. in dbms
Data independence in DBMS refers to the ability to make changes to the database schema at one
level (e.g., physical storage) without affecting the schema at other levels (e.g., logical structure or
user views). This principle simplifies database maintenance and enhances flexibility, allowing for
evolution and adaptation without disrupting application programs or user interfaces.
Allows changes to the physical storage and management of data (e.g., switching from hard drives
to SSDs) without requiring alterations to the logical schema or application programs.
Entity-Relationship (ER) diagram visually represents the structure of a database, outlining entities,
their attributes, and relationships. Here are four key elements: Entities, which are represented as
rectangles, Attributes, depicted as ellipses, Relationships, symbolized by diamond shapes, and
Cardinality, indicating the number of entities involved in a relationship.
1. Entities:
Entities are real-world objects or concepts about which information is stored in the database. They
are represented as rectangles with a name, such as "Employee", "Customer", or "Product". Each
entity represents a specific type of data, like a single customer or a particular product.
2. Attributes:
Attributes describe the characteristics of an entity. They are represented as ellipses and are
connected to the entity rectangle. Attributes are data elements that hold information about the
entity. For instance, an "Employee" entity might have attributes like "EmployeeID", "Name",
"Address", etc.
3. Relationships:
Relationships show how entities are connected or related to each other. They are represented by
diamond shapes, with connecting lines linking the entities involved. Relationships describe the
associations between entities, such as "works in" between "Employee" and "Department", or
"purchases" between "Customer" and "Product".
4. Cardinality:
Cardinality indicates the number of entities that can participate in a relationship. It specifies how
many instances of one entity can be associated with instances of another entity. Cardinality can be
one-to-one, one-to-many, or many-to-many. For example, a "Department" can have many
"Employees," representing a one-to-many relationship.
Q.Explain all joins Commands.in dbms
What is a JOIN?
In DBMS, a JOIN is used to combine rows from two or more tables based on a related column
(usually a foreign key).
. INNER JOIN
Returns all rows from the left table, and matched rows from the right table.
Returns all rows from the right table, and matched rows from the left table.