You are on page 1of 21

RDBMS

UNIT 1 ( BASIC CONCEPTS )

A Database Management System (DBMS) is a software application or system that


provides an organized and structured way to store, manage, retrieve, and manipulate data. It serves as an
intermediary between users or applications and the underlying physical data storage.

Here are some key points to understand about a DBMS:

1. **Data Storage:** A DBMS stores data in a structured format, allowing users to organize information
into tables, rows, and columns. This structured storage makes data retrieval and manipulation more
efficient.

2. **Data Retrieval:** Users can query the DBMS to retrieve specific information from the stored data
using query languages like SQL (Structured Query Language).

3. **Data Manipulation:** Users can perform various operations on the stored data, such as adding new
records (insert), updating existing records (update), deleting records (delete), and more.

4. **Data Integrity:** A DBMS enforces data integrity by applying rules and constraints to ensure the
accuracy and consistency of the stored data. This helps prevent data corruption and maintains data
quality.

5. **Concurrency Control:** When multiple users or applications access the database simultaneously,
the DBMS ensures that data remains consistent and that transactions are properly managed to prevent
conflicts.

6. **Security:** DBMSs offer security features to control access to data. This includes user
authentication, authorization, and encryption to protect sensitive data from unauthorized access.

7. **Backup and Recovery:** DBMSs often provide mechanisms for creating backups of the data to
prevent data loss in case of hardware failures or other issues. Recovery features help restore the database
to a consistent state after failures.

8. **Transaction Management:** A transaction is a sequence of database operations that are executed as


a single unit of work. DBMSs ensure that transactions follow the ACID properties (Atomicity,
Consistency, Isolation, Durability) to maintain data integrity.
9. **Query Optimization:** When users query the database, the DBMS optimizes the execution plan to
retrieve data efficiently. This involves selecting the best way to access and retrieve the required data.

10. **Indexing:** DBMSs use indexing structures to speed up data retrieval. Indexes are data structures
that provide quick access to data based on the values in specific columns.

11. **Data Modeling:** DBMSs support data modeling, allowing users to define the structure of the data
using tables, relationships, and constraints.

12. **Normalization:** In relational DBMSs, normalization is a process of organizing data to minimize


redundancy and improve data integrity. It involves breaking down large tables into smaller, related
tables.

There are different types of DBMSs, including:

- **Relational DBMS (RDBMS):** Organizes data into tables with predefined schemas. Examples
include MySQL, PostgreSQL, Oracle Database.

- **NoSQL DBMS:** Designed for handling unstructured or semi-structured data. Examples include
MongoDB (document-oriented), Cassandra (column-family), and Redis (key-value).

- **NewSQL DBMS:** A modern evolution of RDBMSs, designed to handle high-performance and


scalability requirements.

- **Graph DBMS:** Designed for managing and querying data with complex relationships and
connections.

The choice of a DBMS depends on factors such as the type of data, scalability needs, performance
requirements, and the specific use case of the application.
A file-based system, often referred to as a file system, is a method for organizing and storing
computer data and files. It's a basic approach to managing data on a storage medium, such as a hard
drive or solid-state drive. In this system, data is organized into individual files, and these files are grouped
into directories (also called folders) to create a hierarchical structure.

Here are some key characteristics and features of a file-based system:

1. **Files:** Files are individual units of data storage. They can contain various types of data, such as
text documents, images, videos, audio recordings, programs, and more.

2. **Directories/Folders:** Directories are containers that hold related files. They allow for the
organization and grouping of files into a structured hierarchy. Directories can contain both files and
other subdirectories.

3. **File Naming:** Files are typically given names that provide a way to identify and distinguish them.
File names can include letters, numbers, and symbols, but they often have restrictions based on the file
system and operating system being used.

4. **Path:** A path specifies the location of a file or directory within the file system's hierarchy. It
consists of the names of directories and subdirectories separated by slashes ("/" or "\") to indicate the
file's location.

5. **Metadata:** Files usually come with metadata, which includes attributes like file size, creation date,
modification date, and access permissions. Metadata provides additional information about the file and
its properties.

6. **Access Methods:** File-based systems provide basic methods for accessing and manipulating files,
such as reading, writing, and deleting. Access is controlled through file permissions that determine who
can perform specific actions on the file.

7. **Data Redundancy:** Data redundancy can occur because the same data might be duplicated in
multiple files. This redundancy can lead to data inconsistency and inefficiency.

8. **Data Integrity:** Maintaining data integrity can be a challenge in file-based systems. Since there's
no centralized control, ensuring consistency and accuracy across files can be complex.

9. **Data Independence:** In file-based systems, data and programs are closely tied together. Modifying
the structure of data often requires changing the programs that use the data.

10. **Data Retrieval:** Finding and accessing specific data within files can become difficult as the
number of files and directories grows. Users need to know the file's location to retrieve the data.
11. **Scalability:** File-based systems can become unwieldy as the volume of data and the number of
files increase. This can lead to challenges in managing and organizing data effectively.

File-based systems were common in the early days of computing when applications managed their own
data using files. However, due to the limitations and challenges associated with these systems, more
advanced approaches like Database Management Systems (DBMS) have become prevalent. DBMSs
provide structured methods for managing, querying, and organizing data, offering better data integrity,
scalability, and security compared to traditional file-based systems.

Database Management Systems (DBMS) offer numerous advantages


over traditional file-based systems. Some of the key advantages include:
1. **Data Integrity and Consistency:** DBMS enforces data integrity through constraints and validation
rules, reducing the risk of inconsistent or erroneous data. This ensures that data remains accurate and
reliable.

2. **Reduced Data Redundancy:** DBMS minimizes data redundancy by allowing data to be stored in a
centralized manner. This reduces the chances of duplicate or conflicting data.

3. **Data Security:** DBMS provides robust access control and authentication mechanisms, allowing
administrators to grant specific permissions to users. This enhances data security and privacy.

4. **Concurrent Data Access:** DBMS manages concurrent access to data, ensuring that multiple users
can work with the data simultaneously without causing conflicts or data corruption.

5. **Data Independence:** DBMS abstracts the physical storage details from application programs,
allowing changes to the database structure without affecting the applications. This promotes data
independence and reduces maintenance efforts.

6. **Data Relationships:** DBMS enables the creation and management of relationships between
different data elements, ensuring data integrity and enabling efficient data retrieval.

7. **Querying and Reporting:** DBMS provides powerful query languages (such as SQL) that simplify
data retrieval and manipulation. This allows users to easily extract the information they need for
reporting and analysis.

8. **Transaction Management:** DBMS ensures that database operations are executed as transactions
with ACID properties (Atomicity, Consistency, Isolation, Durability), preventing data inconsistencies and
preserving data integrity.

9. **Data Centralization:** DBMS centralizes data storage, making it easier to manage and back up.
This reduces the likelihood of data loss and simplifies disaster recovery processes.

10. **Scalability:** DBMS supports scaling by providing features like indexing, partitioning, and
replication. This allows for the efficient management of large amounts of data and increasing system
performance.

11. **Backup and Recovery:** DBMS offers mechanisms for creating backups of the data, protecting
against data loss due to hardware failures, software glitches, or other issues.

12. **Data Modeling:** DBMS provides tools for designing and modeling the database structure, which
aids in creating efficient and well-organized databases.
13. **Data Analytics:** DBMS supports data analysis by offering features for aggregation, filtering, and
computation, enabling businesses to make informed decisions based on data.

14. **Application Development:** DBMS simplifies application development by offering APIs and
libraries that handle data interactions. Developers can focus on business logic rather than low-level data
management.

15. **Cost Efficiency:** While there might be initial setup and maintenance costs, DBMS offers long-
term cost savings through improved data management, reduced development time, and minimized data-
related problems.

In summary, DBMS provides a structured, efficient, and secure approach to managing data compared to
traditional file-based systems. This makes them essential for modern businesses and applications that rely
on accurate and accessible data.
The database approach, also known as the relational database approach, is a method of
managing and organizing data using a Database Management System (DBMS). It involves structuring
data in a way that facilitates efficient storage, retrieval, manipulation, and maintenance. The core concept
of the database approach is the use of a relational model, where data is organized into tables with rows
and columns, and relationships between tables are established using keys.

Here are the key characteristics and features of the database approach:

1. **Data Organization:** Data is organized into tables (also called relations), where each table
represents a specific entity type (e.g., customers, orders) and each row represents an instance of that
entity (e.g., a specific customer or order).

2. **Tables and Columns:** Tables consist of columns (attributes) that represent specific pieces of
information. Each column has a defined data type, such as text, number, date, etc.

3. **Rows and Records:** Rows within a table hold the actual data instances (records). Each column
value in a row corresponds to a specific attribute of that record.

4. **Keys:** Keys are used to uniquely identify records within a table. The primary key uniquely
identifies each record, and foreign keys establish relationships between tables.

5. **Normalization:** The database approach emphasizes normalization, which involves organizing data
to minimize redundancy and improve data integrity. This process helps eliminate data anomalies and
inconsistencies.

6. **SQL (Structured Query Language):** SQL is the standard query language used in the database
approach to interact with the DBMS. It provides commands for creating, querying, updating, and
managing the database.

7. **Data Integrity and Constraints:** Constraints are rules applied to data to ensure its accuracy and
consistency. Common constraints include uniqueness, foreign key references, and data validation rules.

8. **Relational Model:** The relational model allows for defining and maintaining relationships between
different tables. This enables the representation of complex data structures and supports efficient
querying.

9. **Data Independence:** The database approach separates the logical view of data from its physical
storage, allowing changes to the database structure without affecting the applications that use the data.

10. **Security and Access Control:** The database approach provides robust access control mechanisms,
allowing administrators to control who can access, modify, and view specific data.
11. **Transaction Management:** Transactions ensure that a sequence of operations is executed as a
single unit of work. DBMSs ensure ACID properties (Atomicity, Consistency, Isolation, Durability) of
transactions.

12. **Data Retrieval and Reporting:** The database approach offers powerful querying capabilities that
allow users to retrieve specific data using various criteria. It also supports the generation of reports and
summaries.

13. **Scalability:** Database systems are designed to handle large volumes of data and can scale by
optimizing data storage and indexing techniques.

14. **Backup and Recovery:** Database systems offer backup and recovery mechanisms to protect data
from hardware failures and other issues.

15. **Data Modeling and Design:** Database systems often provide tools for data modeling and design,
helping users create well-structured databases that meet their business requirements.

The database approach is widely used in modern applications and organizations because of its ability to
provide efficient, secure, and structured data management, enabling businesses to make informed
decisions based on accurate and accessible data.
The Three-Level Architecture, also known as the Logical DBMS Architecture, is a
conceptual framework that describes how a Database Management System (DBMS) is structured. It
divides the DBMS into three distinct layers or levels, each serving a specific purpose. This architecture is
designed to provide data independence, efficient management, and separation between different aspects
of the database system. The three levels are:

1. **External Level (View Level):**

- Also known as the "User Level" or "View Level."

- This is the topmost level, where individual user interactions with the database occur.

- It defines the user's view of the data, including what data is visible and how it's presented.

- Users at this level interact with the database using high-level query languages (such as SQL) to
retrieve and manipulate data.

- Different users or user groups might have different views of the data based on their specific needs.

2. **Conceptual Level (Logical Level):**

- Also known as the "Logical Level."

- This level represents the overall logical structure of the entire database.

- It focuses on defining the relationships between various data elements and entities within the database.

- The conceptual schema, which describes the logical organization of data and relationships, is defined
at this level.

- The conceptual level provides data independence by abstracting the physical storage details from
users and applications.

- Changes to the conceptual schema don't affect the external views, ensuring that applications can
remain unchanged when the database structure evolves.

3. **Internal Level (Storage Level):**

- Also known as the "Physical Level" or "Storage Level."

- This is the lowest level of the architecture and deals with the physical storage and access methods of
data.

- It describes how data is stored on the storage media, including details like data storage formats,
indexing, and data retrieval mechanisms.

- The internal schema, defined at this level, maps the logical schema to the physical storage structures.

- Performance optimization, data compression, and data security measures are implemented at this
level.

- Changes to the internal schema don't affect the logical and external levels, providing further data
independence.

The Three-Level Architecture provides several benefits, including:


- **Data Independence:** Changes to the physical storage or logical organization of data do not impact
the way users and applications interact with the database, ensuring data independence and reducing the
risk of disruption during changes.

- **Security and Privacy:** Different users or user groups can have restricted access to specific views of
the data, enhancing data security and privacy.

- **Concurrent Development:** Application developers can work on their applications without needing
to understand the entire physical structure of the database. They only need to focus on the external and
logical levels.

- **Adaptability:** The architecture allows for modifications to the database structure to accommodate
changing business requirements without affecting the applications and users.

- **Efficiency:** Performance enhancements can be implemented at the internal level without affecting
the logical and external levels.

The Three-Level Architecture is a foundational concept in the design and implementation of modern
DBMSs, helping to ensure efficient data management, scalability, and maintainability.
A Database Administrator (DBA) is responsible for managing and maintaining a
Database Management System (DBMS) and the databases it contains. The DBA's role is essential in
ensuring the integrity, security, performance, and availability of the organization's data. Here are the key
functions and roles of a DBA:

1. **Database Design and Planning:**

- Collaborating with stakeholders to design and plan the structure of databases to meet business
requirements.

- Defining tables, relationships, constraints, and indexes to optimize data storage and retrieval.

2. **Installation and Configuration:**

- Installing, configuring, and upgrading DBMS software on servers, cloud platforms, or data centers.

- Tuning database parameters to achieve optimal performance and resource utilization.

3. **Security Management:**

- Implementing security measures to protect data from unauthorized access, breaches, and data theft.

- Setting up user authentication, authorization, and role-based access controls.

4. **Backup and Recovery:**

- Developing and implementing backup and recovery strategies to ensure data integrity and availability.

- Regularly performing backups, testing recovery procedures, and managing disaster recovery plans.

5. **Performance Optimization:**

- Monitoring database performance, identifying bottlenecks, and optimizing query execution.

- Analyzing and improving system performance by tuning SQL queries, indexes, and database
configurations.

6. **Capacity Planning:**

- Estimating future storage and processing needs based on data growth and user demands.

- Scaling the infrastructure to accommodate increasing workloads and data volumes.

7. **Data Migration and Upgrades:**

- Planning and executing data migrations between databases or upgrading to new DBMS versions.

- Ensuring data consistency, integrity, and minimal downtime during migrations.

8. **Data Integrity and Maintenance:**


- Enforcing data integrity constraints to maintain data accuracy and consistency.

- Performing routine maintenance tasks, such as data purging and archiving.

9. **Security Auditing and Compliance:**

- Monitoring database activities for security breaches, unusual access patterns, and compliance
violations.

- Ensuring adherence to data protection regulations and industry standards.

10. **Disaster Recovery Planning:**

- Developing disaster recovery plans to minimize data loss and system downtime during crises.

- Conducting regular tests and drills to validate the effectiveness of recovery procedures.

11. **Database Monitoring and Troubleshooting:**

- Continuously monitoring database health, performance metrics, and system alerts.

- Identifying and resolving issues, errors, and performance bottlenecks in a timely manner.

12. **User Support and Training:**

- Assisting users with database-related inquiries, issues, and requirements.

- Providing training to users and application developers on database tools and best practices.

13. **Patch Management and Upgrades:**

- Keeping the DBMS and related software up to date with security patches and software upgrades.

- Applying patches and updates to address vulnerabilities and improve functionality.

14. **Collaboration and Communication:**

- Collaborating with application developers, system administrators, and business stakeholders to


ensure effective database integration and performance.

15. **Documentation:**

- Maintaining accurate and up-to-date documentation of database configurations, procedures, and


processes for reference and knowledge sharing.

The role of a Database Administrator requires technical expertise in database technologies, problem-
solving skills, attention to detail, and a proactive approach to ensure that the organization's data
infrastructure operates efficiently and securely.
The Relational Model and the Entity-Relationship (ER) Model are two
fundamental concepts in database design and management. They provide methods for representing and
organizing data within a Database Management System (DBMS). Let's explore both models:

**Relational Model:**

The Relational Model is the foundation of modern relational database systems. It was introduced by E.F.
Codd in the 1970s and is based on the principles of set theory and predicate logic. In the Relational
Model:

1. **Data Representation:** Data is represented as tables (relations), where each table consists of rows
(tuples) and columns (attributes).

2. **Entities:** Tables in the Relational Model often correspond to entities in the real world or to logical
categories.

3. **Attributes:** Columns represent attributes (characteristics) of the entities, and each cell contains a
single data value.

4. **Keys:** Keys are used to uniquely identify each row in a table. The primary key uniquely identifies a
row, and foreign keys establish relationships between tables.

5. **Relationships:** Relationships between entities are established through keys. For example, a foreign
key in one table refers to the primary key in another table.

6. **Normalization:** The Relational Model encourages normalization, which involves organizing data to
eliminate redundancy and anomalies.

7. **SQL (Structured Query Language):** SQL is used to interact with relational databases. It allows for
data retrieval, manipulation, and management.

**Entity-Relationship (ER) Model:**

The Entity-Relationship Model is a conceptual model introduced by Peter Chen in the 1970s. It focuses on
visualizing the data structure and relationships in a database:

1. **Entities:** Entities represent real-world objects, concepts, or things that are relevant to the
application domain. Each entity is depicted as a rectangle in ER diagrams.

2. **Attributes:** Attributes describe the properties or characteristics of entities and are shown as ovals
connected to entities.

3. **Relationships:** Relationships describe associations between entities. They can be one-to-one, one-
to-many, or many-to-many, and are depicted using lines connecting the entities.

4. **Cardinality and Participation:** Cardinality defines the number of instances of one entity that can
be associated with instances of another entity. Participation indicates whether an entity is mandatory
(total participation) or optional (partial participation) in a relationship.

5. **Keys:** Keys in the ER Model are often used to uniquely identify entities. Primary keys identify
entities within their own entity sets.

6. **Normalization:** While the ER Model doesn't directly address normalization, it provides a


foundation for understanding relationships and dependencies, which can guide the normalization process.
In summary, both the Relational Model and the ER Model are essential tools for designing and
understanding databases. The Relational Model focuses on representing data in tables with rows and
columns, emphasizing relationships through keys and promoting data integrity. The ER Model focuses on
visually representing entities, attributes, and relationships, aiding in conceptual database design. These
models complement each other and are commonly used together in the process of database design and
development.
In a Database Management System (DBMS), a domain refers to the set of possible values that an
attribute (column) in a table can hold. Domains define the data type, format, and constraints for a specific
attribute. They help ensure data consistency, accuracy, and integrity within the database. Here's a more
detailed explanation of domains in DBMS:

1. **Data Type Definition:** A domain defines the allowable data types for an attribute. Common data
types include integers, floating-point numbers, strings, dates, and more. The domain specifies the data
type and constraints associated with it.

2. **Format and Constraints:** Domains can include rules and constraints that define the format and
characteristics of the data. For example, a domain for a "Phone Number" attribute might specify that the
value should follow a specific pattern (such as XXX-XXX-XXXX) and only allow valid phone numbers.

3. **Data Validation:** Domains play a crucial role in data validation. They help ensure that only valid
and appropriate values are inserted into the database. This prevents incorrect or inconsistent data from
being stored.

4. **Data Integrity:** By defining domains with appropriate constraints, you can maintain data integrity
and prevent the insertion of incorrect or inappropriate values. For example, a domain constraint might
ensure that an "Age" attribute only contains positive integer values.

5. **Domain Reuse:** Domains can be reused across multiple tables and attributes. This promotes
consistency in data types and constraints, making it easier to manage and maintain the database.

6. **Abstraction:** Domains provide an abstraction layer that separates the logical description of the
data from its physical storage. This abstraction enhances data independence by allowing changes to the
domain without affecting the application layer.

7. **Data Modeling:** When designing a database, domains help in defining the characteristics of
attributes. They contribute to the overall data model and schema design.

8. **Domain Constraints:** Domain constraints include rules such as minimum and maximum values,
data ranges, uniqueness constraints, and referential integrity rules. These constraints are applied to
ensure data quality.

For example, consider a domain "Email Address" that specifies the data type as string and includes a
constraint to ensure that the value contains the "@" symbol and a valid domain name. This domain can
be used in multiple tables to store email addresses, and the validation rules are consistently applied across
the database.
In summary, domains in DBMS provide a structured way to define data types, formats, and constraints
for attributes in a database. They contribute to data consistency, validation, integrity, and help maintain
a high level of data quality throughout the database.
In a Database Management System (DBMS), "tuple" and "relation" are terms that are
closely associated with the relational model, which is the foundation of most modern DBMSs. Let's
explore what each term means:

1. **Tuple:**

- A tuple is a single row or record in a relational database table.

- Each tuple represents a specific data instance or entity within the context of the table.

- Tuples consist of a set of attributes (columns), each containing a specific value corresponding to that
attribute for the given data instance.

- In other words, a tuple represents a single data record in a table, containing values for each attribute.

2. **Relation:**

- A relation is another term for a table in the relational database model.

- A relation consists of multiple tuples, each representing a different data instance or record within the
table.

- The term "relation" is used to emphasize the mathematical and theoretical foundations of the
relational model, where relations are sets of tuples.

- A relation is defined by its name, attributes (columns), and the domain of possible values for each
attribute.

In summary, in the context of a relational database:

- A "tuple" refers to a single row or record containing values for each attribute in a table.

- A "relation" refers to the entire table itself, which consists of multiple tuples or rows.

Together, tuples and relations form the fundamental structure for representing and organizing data in a
relational database, enabling efficient storage, retrieval, and manipulation of information.
An Entity-Relationship (ER) diagram is a graphical representation of the data model
that depicts entities, attributes, relationships, and constraints within a database system. ER diagrams are
widely used in database design to visually represent the logical structure of a database and its
components. They help in understanding and communicating the relationships between various entities in
a clear and concise manner. Here are the key components and symbols used in an ER diagram:

1. **Entity:**

- An entity represents a real-world object, concept, or thing that has data to be stored in the database.

- In the diagram, entities are represented as rectangles with the entity name inside.

2. **Attribute:**

- An attribute represents a characteristic or property of an entity.

- Attributes are depicted as ovals connected to their respective entities.

3. **Relationship:**

- A relationship defines an association between two or more entities.

- Relationships are represented by diamond shapes connecting the related entities.

- The lines connecting the diamond to the entities are called relationship lines.

4. **Cardinality:**

- Cardinality specifies the number of instances of one entity that can be associated with instances of
another entity in a relationship.

- Common cardinality notations include "one" (1), "many" (*), or specific numerical values.

5. **Participation:**

- Participation indicates whether an entity is required (total participation) or optional (partial


participation) in a relationship.

- Participation is often indicated using the symbols "I" (for total participation) and "O" (for partial
participation).

6. **Primary Key:**

- A primary key uniquely identifies each instance of an entity.

- In the ER diagram, the primary key attribute(s) are underlined or highlighted.

7. **Foreign Key:**

- A foreign key is an attribute in one entity that references the primary key of another entity.

- It represents a relationship between entities and ensures referential integrity.


8. **Weak Entity:**

- A weak entity depends on another entity (known as its owner) for its existence.

- Weak entities are indicated by double rectangles.

9. **Attribute Types:**

- Attributes can be classified as simple attributes (atomic values) or composite attributes (composed of
subattributes).

- Multivalued attributes (attributes with multiple values) are represented using double ovals.

ER diagrams provide a visual representation of the database schema and its relationships, making it
easier to design, communicate, and understand the database structure. They are commonly used during
the database design process to model entities, attributes, relationships, and constraints before
implementing the actual database schema in a DBMS.
Relational constraints are rules and conditions applied to the data in a relational database to
maintain data integrity, consistency, and accuracy. These constraints ensure that the data stored in the
database follows predefined rules, preventing data anomalies and errors. Here are the key relational
constraints with their definitions:

1. **Primary Key Constraint:**

- A primary key constraint ensures that a specific column or set of columns in a table uniquely identify
each row.

- It guarantees that the values in the primary key column(s) are unique and not null.

- The primary key uniquely identifies each record in the table and serves as a reference for relationships
with other tables.

2. **Foreign Key Constraint:**

- A foreign key constraint establishes a link between two tables by referencing the primary key of one
table as a foreign key in another table.

- It enforces referential integrity by ensuring that the values in the foreign key column(s) of the
referencing table match the values in the primary key column(s) of the referenced table.

3. **Unique Constraint:**

- A unique constraint ensures that the values in a specified column or set of columns are unique across
all rows in the table.

- Unlike the primary key, unique constraints allow null values.

4. **Check Constraint:**

- A check constraint defines a condition that must be satisfied by the values in a column.

- It ensures that the data adheres to specific rules or conditions. For example, a check constraint could
enforce that ages in a column must be greater than zero.

5. **Not Null Constraint:**

- A not-null constraint ensures that a specified column cannot contain null values.

- It guarantees that every row must have a valid value in the column.

6. **Default Constraint:**

- A default constraint specifies a default value for a column to be used when no explicit value is
provided during insertion.

- It ensures that rows contain a value even if one is not explicitly provided.

7. **Referential Integrity Constraint:**


- Referential integrity constraints maintain relationships between tables by ensuring that foreign keys
match primary keys.

- They prevent actions that would lead to orphaned records or inconsistencies in related data.

8. **Domain Constraint:**

- A domain constraint specifies the allowable values for a column based on its data type.

- It ensures that only valid data is inserted into the column, preventing inappropriate values.

These constraints are enforced by the Database Management System (DBMS) during data insertion,
updating, and deletion operations. They play a critical role in maintaining data quality and preventing
issues that could arise from data inconsistencies or inaccuracies.

You might also like