DBMS Interview Questions
DBMS Interview Questions
1.What is DBMS ?
Ans. DBMS is a collection of programs that facilitates the user that enable them
to create and maintain a database. DBMS provides a tool or an interface for
performing various operations such as inserting , deleting , updating, etc into the
database. Example:- MySQL, Oracle, etc.
2.What is RDBMS?
Ans. RDBMS was introduced in 1970s to access and store data in the form of
rows and tables. DBMS stored the data in the form of files. Storing data in the
form of files makes it easier to access the database. Example:- MySQL, Oracle.
3.What is SQL and NoSQL?
Ans. SQL databases are called RDBMS where data is stored in the form of tables .
It has a fixed schema .It follows ACID property. It is best suited for complex
queries.
NoSQL means non-relational databases. It stores data in a form other than
relational tables. It is an ideal choice for big data as new data can be easily
inserted without wasting any time.
There a 4 types of NoSQL databases:-
a. Key-value pair b. Column oriented c. graph based d. Document oriented
*The main advantage of NoSQL databases are high scalability and structure of
the data can be easily changed.
Example:-MongoDB, CouchDB etc.
{ // example of key-value pair NoSQL data
“name”: ”harsh”,
“class”:”10”,
“roll no”:12
}
4.Disadvantages of file system.
Ans. a. Redundancy and inconsistency as files may have duplicate and redundant
data and changing one of them will make all of them inconsistent.
b. Accessing data is harder in traditional file system because data is unorganized
in them.
c. Lack of Concurrency control ,which leads to one operation locking the entire
page as compared to dbms where multiple operations can work on a single file
simultaneously.
d. Security , atomicity etc are other issues.
5. Explain Entity, Entity Type, and Entity Set in DBMS?
entity is an object, place, or thing which has its independent existence in the real world and about
which data can be stored in a database. For Example, any person, book, etc.
Entity Type is a collection of entities that have the same attributes. For Example, the STUDENT
table contains rows in which each row is an entity holding the attributes like name, age, and id of
the students, hence STUDENT is an Entity Type that holds the entities having the same attributes.
Entity Set is a collection of entities of the same type. For Example, A collection of the employees
of a firm.
6.What is functional Dependency ?
Ans. The functional dependency is a relationship that exists between two
attributes. It typically exists between a primary key and non-key attribute within
a table. https://www.javatpoint.com/dbms-functional-dependency.
Page-6
7. Keys in DBMS ?
Ans. Keys are the attributes with the help of which we can identify a row/tuple
in a table.
There are 6 types of keys:-
a. Primary Key:- Primary key is a set of attribute which uniquely identify the
tuples in relation or table. There can only be one primary key in any
relationship. It is optional to specify any relation . Example- Student(ID,
Aadhar_ID, Fname, Lname, Age)
Here only ID or Aadhar_ID can be primary key because the name can be
common but ID or Aadhar_ID cannot be same.
b. Candidate Key: - Candidate key is a set of attributes which uniquely
identifies the tuples in relation or table. Candidate key is called a minimal
super key because we select a candidate key from a set of super keys . (It
can be NULL but primary key can’t). Without a candidate key there can’t be
specified any relation.
c. Super Key:- Super key is an attribute that is used to uniquely identifies all
attributes in a relation. A candidate key is also a super key. It can have
NULL values. https://media.geeksforgeeks.org/wp-content/uploads/20230314093236/keys-in-
dbms.jpg
d. Alternate Key:- The candidate key other than the primary key is called an
alternate key. All the keys that are not primary keys are called alternate
keys. https://media.geeksforgeeks.org/wp-content/uploads/20230314093606/Primary-key-alternative-
key-in-dbms.png
e. Foreign Key:- The key that acts as a alternate/secondary key in one table
and it acts as primary key in another table is called Foreign key. It combines
two or more relations(tables) at a time.
NOTE. It is used to maintain referential Integrity.
f. Composite Key:- A composite key is made by the combination of two or
more columns in a table that can be used to uniquely identify each row in
a table .