Top DBMS Interview Questions and Answers (2024 Updated) - InterviewBit
Top DBMS Interview Questions and Answers (2024 Updated) - InterviewBit
the most commonly asked DBMS interview questions to help you ace your
interview!
Learn More
Create A Free
Personalised Study
Plan Create
My
Get into your dream companies Plan
with expert guidance
2. What is a Database?
A Database is an organized, consistent, and logical collection of data that
can easily be updated, accessed, and managed. Database mostly
contains sets of tables or objects (anything created using create command
is a database object) which consist of records and fields. A tuple or a row
represents a single entry in a table. An attribute or a column represents
the basic units of data storage, which contain information about a
particular aspect of the table. DBMS extracts data from a database in the
form of queries given by the user.
Integrity check, data isolation, atomicity, security, etc. are some other
issues with traditional file-based systems for which DBMSs have provided
some good solutions.
Real-Life Detailed
Problems reports
External or View level: it is the level that describes only part of the
database and hides the details of the table schema and its physical
storage from the users. The result of a query is an example of View
level data abstraction. A view is a virtual table created by selecting
fields from one or more tables present in the database.
3. What is meant by an entity-relationship (E-R) model?
Explain the terms Entity, Entity Type, and Entity Set in
DBMS.
An entity-relationship model is a diagrammatic approach to a database
design where real-world objects are represented as entities and
relationships between them are mentioned.
Entity Set: An entity set can be defined as a set of all the entities
present in a specific entity type in a database. For example, a set of
all the students, employees, teachers, etc. represent an entity set.
4. Explain different types of relationships amongst
tables in a DBMS.
Following are different types of relationship amongst tables in a DBMS
system:
It deletes only the rows which are specified by the WHERE clause.
It maintains a log to lock the row of the table before deleting it and
hence it’s slow.
TRUNCATE command: this command is needed to remove complete
data from a table in a database. It is like a DELETE command which has
no WHERE clause.
It doesn’t maintain a log and deletes the whole table at once and
hence it’s fast.
Shared Lock: A shared lock is required for reading a data item and
many transactions may hold a lock on the same data item in a shared
lock. Multiple transactions are allowed to read the data items in a
shared lock.
1NF: It is known as the first normal form and is the simplest type of
normalization that you can implement in a database. A table to be in
its first normal form should satisfy the following conditions:
Every column must have a single value and should be atomic.
Super Key: The super key defines a set of attributes that can
uniquely identify a tuple. Candidate key and primary key are subsets
of the super key, in other words, the super key is their superset.
Primary Key: The primary key defines a set of attributes that are
used to uniquely identify every tuple. In the below example studentId
and firstName are candidate keys and any one of them can be
chosen as a Primary Key. In the given example studentId is chosen
as the primary key for the student table.
Unique Key: The unique key is very similar to the primary key except
that primary keys don’t allow NULL values in the column but unique
keys allow them. So essentially unique keys are primary keys with
NULL values.
Alternate Key: All the candidate keys which are not chosen as
primary keys are considered as alternate Keys. In the below example,
firstname and lastname are alternate keys in the database.
Foreign Key: The foreign key defines an attribute that can only take
the values present in one table common to the attribute present in
another table. In the below example courseId from the Student table
is a foreign key to the Course table, as both, the tables contain
courseId as one of their attributes.
The 3-tier architecture contains another layer between the client and the
server to provide GUI to the users and make the system much more
secure and accessible. In this type of architecture, the application present
on the client end interacts with an application on the server end which
further communicates with the database system.