Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
37 views

DBMS Interview Questions

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

DBMS Interview Questions

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

What is DBMS?

DBMS is a general-purpose software system that facilitates the process of defining,


constructing, manipulating and sharing of databases among various users and
applications. It helps in reducing data redundancy by enforcing integrity constraints
and providing protection against unauthorised access. Additionally, it provides
backup and recovery options.

What is a database?

A database is a single repository of logically related data. All the data inside a
database can be used to interpret a real-life scenario. There are various kinds of
databases namely relational and NoSQL databases.

What is a database system?

DBMS and database together is called as database system.

What is the difference between SQL and a DBMS?

DBMS is a software that enables defining, manipulating and sharing of databases


among users and applications which can be achieved through a programming
language called SQL. SQL stands for Structured query language, it is used to query
and create, drop and manipulate data in the databases.

Database approach vs File system approach

File system approach is now replaced by databases across organisations because of


the self defining nature of a database, program-data independence and program
operation independence and support of multiple views.

Self defining nature of a database refers to the customization of the logical schema
of a database whereas in a file system, the flexibility is defining the schema is not
supported.

In a database, the program and the data are separated from each other. Changing
one won’t affect the other. This refers to program data independence.
Difference between a query and a transaction

A query is a SQL code that is implemented to retrieve data from the database
whereas a transaction is a SQL code that causes some data to be read and written
into the database.

What are the properties of a transaction?

A transaction is characterized by 4 properties namely Atomicity, Consistency,


Isolation and
Durability.
Atomicity refers to the occurrence of all database operations within a transaction as
a whole. Either all database operations occur or the transaction doesn’t occur at all.

Consistency refers to the satisfaction of all defined constraints before and after a
transaction.

Isolation refers to the occurrence of concurrent multiple transactions on a database


but each independent of one another.

The changes made to a database are written to the storage. This ensures that the
database is durable even in case of system failure.

What is meant by referential integrity constraint and what is meant by


uniqueness constraint?

There are 2 classes of constraints namely referential integrity constraint and


uniqueness constraint.

Referential integrity constraint refers to a condition that the tables in a database must
be related to each other and it is achieved using a foreign key.

Uniqueness constraint refers to the condition where the records in a table must be
unique.

What are the different levels of data abstraction in a database?

There are three levels of data abstraction - on the physical level, logical level and
View level.
What’s the 3 schema architecture?

The 3 schema architecture of a DBMS defines the different schemas implemented


on the different hierarchical levels of a DBMS.
The internal schema is defined for the physical layer, conceptual schema is defined
for the logical layer and the external schema on the view layer.

Internal schema is a physical data model that describes the access paths for the
database.

Conceptual schema describes the structure of the database without describing the
implementation details.

External schema describes the part of the database that a user group is interested
in.

What is data independence in the context of DBMS?

The capacity to change the schema at one level of the database system without
having to change the schema at the higher level is called data independence.

There are 2 types of data independence. They are physical data independence and
logical data independence.

What are the various DBMS languages?

There are 4 types of DBMS languages. They are Data definition language (DDL),
Data Manipulation language (DML), Data Control Language(DCL) and Transaction
Control Language(TCL).

DDL is used to define schemas. DML is used to perform database operations.. DCL
is used to grant or revoke privileges and TCL is used to manage transactions.

What are the various DDL commands?

CREATE, DESC, ALTER, TRUNC, DROP.

Create - To create a database object


Desc - To retrieve the schema
Alter - To change the schema and to add/ remove constraints.
Trunc -
Drop - To delete the schema and data inside the database object.
What are the various DML commands?

SELECT, INSERT, DELETE, UPDATE.

What are the various DCL commands?

GRANT, REVOKE are the various DCL commands.

What are the various TCL commands?

COMMIT, SAVEPOINT, ROLLBACK are the various TCL commands.

What is the default date format in Oracle SQL?

‘DD-MON-YYYY’

What is the difference between DELETE, TRUNCATE and DROP?

DELETE is used to delete the records in a database and the schema remains intact
but the deleted records are restorable whereas TRUNCATE is used to delete records
permanently and to keep the schema intact whereas DROP permanently removes
the existence of the database object along with the records in it.

TRUNCATE is faster than DELETE.

Can Rollback be used after TRUNCATE?

No, rollback can’t be used after TRUNCATE.

Can rollback be used after DELETE?

Yes, rollback can be used after DELETE.


What are the types of attributes?

Attributes are the columns in a relational database. They represent the properties of
an entity in a real world scenario. Following are the various classifications of
attributes:

– Simple vs composite
– Single valued vs multi valued
– Stored vs derived
– NULL attribute

Define intension and extension of a database?

Intension refers to the schema of the database whereas extension refers to the
cardinality of the database at any given point.

What is an ER model?

ER model stands for Entity relationship model. It is a high-level model that is used to
describe the conceptual schema of the database using entity types, attributes and
relationships among the entities. It doesn’t discuss the implementation of the
database.

Differentiate between relational algebra and relational calculus?

Relational algebra is defined by the basic set of operations of relational algebra. It is


a procedural language whereas relational calculus is a non-procedural, declarative
language. There’s no order of operations to specify how to retrieve the query result.

What are the various relational algebraic operations?

SELECT, PROJECT, RENAME, DIVISION, UNION, INTERSECT, JOIN,


DIFFERENCE are the various relational algebraic operations

What are the various set and multiset operations of relational algebra?

UNION, INTERSECT and EXCEPT are the set operations and UNION ALL,
INTERSECT ALL and EXCEPT ALL are the multiset operations.
What is meant by mapping cardinalities?

Mapping cardinality refers to the number of entities to which another entity can be
linked with through a certain relation set.

Following are the types of mapping cardinalities:


– one-one
–many-one
–one-many
–many-many

What is meant by participation constraint?

Participation constraints determine the minimum and maximum participation of


entities or relationships in a given entity set.

Two types of participation constraints. They are:


– Partial participation
– Total participation

What are joins?

Joins are used to combine data from two or more tables based on common
attributes. There are 2 types of joins. They’re inner and outer joins.

Inner Joins are further classified into natural join/equijoin and theta join.
Outer Joins are further classified into left outer join, right outer join and full outer join.

● Theta join - based on condition.


● Natural join - based on common attributes.

Define Normalisation.
Normalisation is the process of dividing a larger table into smaller tables to
minimise redundancy and insertion and deletion anomalies. It’s a top down
approach.
Following are the normal forms: 1NF, 2NF, 3NF, BCNF.
Normal form of a table is the highest normal form to which it can be normalised.
What is lossless and lossy decomposition?

Lossless decomposition of a table refers to decomposing a table into more tables


where upon performing a natural join on the new tables, the original table is obtained
whereas in lossy decomposition, the original table is not obtained.

Define degree and cardinality.

Degree refers to the number of attributes in the table and cardinality refers to the
number of tuples in the table.

What are the various data models?

Relational, Network and hierarchical are various types of data model.

Relational data model stores data in rows and columns. Data can be found by
directly accessing the tables. A parent can have many children and a child can have
many parents.

Network data model stores data in graph format. Data is stored in nodes. A child can
have many parents and a child can have many parents. Searching begins from the
root node.

Hierarchical data model stores data in tree format. Data is stored in nodes. A parent
can have many children but a child can’t have multiple parents. Searching begins
from the root node.

What is a key? What are the different types of keys?

What is 1NF?

What is 2NF?

What is 3NF?

What is BCNF?

What is PL/SQL?
What is a shared lock and an exclusive lock?

You might also like