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

Dbms interview

An integrity constraint is a rule that restricts the values allowed in a database to ensure data accuracy and consistency, with types including entity, referential, domain, and user-defined integrity constraints. Stored attributes are directly stored in the database, derived attributes are calculated from other attributes, and multivalued attributes can have multiple values for a single entity. Data abstraction simplifies database management through physical, logical, and view levels, and normalization organizes data to minimize redundancy and avoid anomalies like insertion, deletion, and update issues.

Uploaded by

biswajitde200
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Dbms interview

An integrity constraint is a rule that restricts the values allowed in a database to ensure data accuracy and consistency, with types including entity, referential, domain, and user-defined integrity constraints. Stored attributes are directly stored in the database, derived attributes are calculated from other attributes, and multivalued attributes can have multiple values for a single entity. Data abstraction simplifies database management through physical, logical, and view levels, and normalization organizes data to minimize redundancy and avoid anomalies like insertion, deletion, and update issues.

Uploaded by

biswajitde200
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

4.Explain what do you mean by integrity constraint?

Discuss the
different types.
Ans:
An integrity constraint is a rule that restricts the values allowed in a
database. It ensures the accuracy and consistency of data stored in the
database. There are several types of integrity constraints:

Entity integrity constraint: Ensures that each row in a table has a


unique and non-null primary key value.

Referential integrity constraint: Ensures that relationships between


tables remain consistent. It typically requires that a foreign key in one
table matches a primary key in another table.

Domain integrity constraint: Enforces rules regarding the permissible


values in a column, such as data type, range, and format constraints.

User-defined integrity constraint: Custom rules defined by the


database designer or administrator to enforce specific business
requirements or data quality standards.

5.Explain stored attribute, derived attribute and multivalued


attribute with example.

**Stored Attribute**: A stored attribute is an attribute whose value is directly stored in the
database. It's typically a piece of information that is directly provided and maintained within a
database table. For example, in a "Student" table, attributes like "StudentID," "Name," and
"DateOfBirth" would be stored attributes because their values are directly entered and stored
in the database.

**Derived Attribute**: A derived attribute is an attribute whose value can be calculated or


derived from other attributes within the same entity or related entities. It is not stored directly
in the database but computed when needed. For instance, in a "Person" entity, the "Age"
attribute could be derived from the "DateOfBirth" attribute. Instead of storing the age directly,
it can be calculated dynamically based on the birth date whenever required.

**Multivalued Attribute**: A multivalued attribute is an attribute that can have multiple


values for a single entity instance. It's essentially a set of values associated with a single
entity occurrence. For example, in a "Student" entity, the "PhoneNumbers" attribute might be
multivalued since a student can have multiple phone numbers. Each phone number is
distinct, but collectively they belong to the same entity instance.
6. What is referential integrity constraint?

Ans: **Referential Integrity Constraint**:


Referential integrity is a concept in database management that ensures the consistency of
relationships between tables. A referential integrity constraint ensures that the values of
foreign key attributes in one table match the values of primary key attributes in another table.
It ensures that relationships between tables remain valid and consistent.

For example, consider two tables: "Orders" and "Customers." The "Orders" table has a
foreign key attribute called "CustomerID," which references the primary key attribute
"CustomerID" in the "Customers" table. The referential integrity constraint ensures that every
value in the "CustomerID" column of the "Orders" table must exist in the "CustomerID"
column of the "Customers" table. This constraint prevents orphaned records and maintains
the integrity of the relationship between orders and customers. If a customer record is
deleted, the referential integrity constraint might dictate that associated order records be
deleted as well, or that the deletion be restricted until associated orders are handled
appropriately.

7.Describe the concept of generalization, specialization &


aggregation in the context of E-R data model through appropriate
example.

Ans :*Generalization, Specialization, and Aggregation**:

- **Generalization**: Generalization is the process of defining a general entity type from a


group of more specialized entity types. It represents the "is-a" relationship between entities.
For example, in a university database, "Student" and "Faculty" entities could be generalized
into a higher-level entity called "Person," as both students and faculty are types of people.

- **Specialization**: Specialization is the opposite of generalization. It involves defining


one or more subtypes from a single entity type based on specific characteristics or attributes.
It represents the "is-a-kind-of" relationship. Using the previous example, "Person" could be
specialized into "Student" and "Faculty" entities, each with their own unique attributes and
characteristics.

- **Aggregation**: Aggregation is a modeling technique used to represent relationships


where one entity contains or is composed of other entities. It represents a "has-a"
relationship. For instance, in a library database, a "Library" entity may aggregate "Book"
entities. This means a library consists of multiple books, and the relationship between a
library and its books is one of aggregation.
8. What do you mean by data abstraction? Explain three levels of
data abstraction.

**Data Abstraction**:

Data abstraction is the process of hiding certain details and showing only essential
information to the user. It helps in managing complexity by allowing users to focus on
relevant aspects of data while ignoring unnecessary details. There are three levels of data
abstraction:

- **Physical Level**: This is the lowest level of abstraction, which describes how data is
stored in the database system. It includes details such as data storage, data types, indexing
methods, etc.

- **Logical Level**: This level describes what data is stored in the database and the
relationships among the data. It hides the physical storage details and focuses on the logical
structure of the data.

- **View Level**: This is the highest level of abstraction, which represents a part or subset
of the database from the user's perspective. It provides different views of the database to
different users based on their requirements, without exposing the entire database schema.

9.Why do we normalize a relation? Describe the anomalies.

**Normalization of Relations**:

Normalization is the process of organizing the attributes and tables of a relational database
to minimize redundancy and dependency. It helps in avoiding anomalies such as insertion,
deletion, and update anomalies, which can occur due to redundant data storage.

Anomalies include:
- **Insertion Anomaly**: Difficulty in adding data to the database due to the absence of
other related data.
- **Deletion Anomaly**: Unintentional loss of data while deleting information not intended
to be deleted.
- **Update Anomaly**: Inconsistency that occurs when updating data in one place but not
in others
10.Explain with example: super key, candidate key and primary key.

- **Super Key**: A super key is a set of attributes that uniquely identifies each tuple (row)
within a relation (table). It may contain more attributes than necessary to uniquely identify
tuples. For example, in a "Person" table, {PersonID, SocialSecurityNumber} could be a
super key.

- **Candidate Key**: A candidate key is a minimal super key, meaning it is a super key
with no unnecessary attributes. It uniquely identifies each tuple within a relation. In other
words, removing any attribute from a candidate key would cause it to lose its uniqueness
property. For example, in the "Person" table, if both PersonID and SocialSecurityNumber
uniquely identify each person, then both are candidate keys.

- **Primary Key**: The primary key is a candidate key chosen by the database designer to
uniquely identify tuples within a relation. It is used to enforce entity integrity and serve as the
main reference point for accessing and retrieving data from the table. In the "Person" table,
the database designer might choose PersonID as the primary key.

You might also like