RDBMS Interview Questions and Answers - Freshers & Experienced

Why a database is called as relational database model?

A database model represents the relationship between one or more databases. The relationship is known as the relational database model. It is an extension of the normal databases without relations. It provides flexibility and allows one database to be in relation with another database. It can access the data from many databases at one time over the network.

What are entities and attributes referring to?

- Table consists of some properties that are known as attributes.
- These consist of the representation of entity in the table.
- They are represented by columns in the table.
- Entity is referred to the store data about any particular thing.
- It is the smallest unit inside the table.

What do you understand by relation in relational database model?

Relation in the relational database model is defined as the set of tuples that have the same attributes. Tuple represents an object and also the information that the object contains. Objects are basically instances of classes and used to hold the larger picture. Relation is described as a table and is organized in rows and columns. The data referenced by the relation come in the same domain and have the same constraints as well. Relations in the relational database model can be modified using the commands like insert, delete etc.

Why domain is of high importance?

- Domain describes possible values grouped together that can be given for an attribute. It is considered the same way as a constraint on the value of attribute.
- A domain can be attached to an attribute but only if the attribute is an element of specified set.

For example: XYZ doesn’t fulfill the domain constraint but the integer value as 899 fulfills the criteria of domain constraint. Hence, domain is of high importance.

What is the difference between base and derived relation?

- Relational database means the relationship between different databases. In relational database user can store and access all the data through the tables which are related to each other.

- Relationship between the store data is called base relations and implementation of it is called as tables. Whereas, relations which don’t store the data, but can be found out by applying relational operations on other relations are called as derived relations. When these are implemented they are termed as views or queries.

- Derived relations are more useful then base relation, as they can have more information from many relations, but they act as a single relation.

What are constraints in database?

Constraints are kind of restrictions that are applied to the database or on the domain of an attribute. For example an integer attribute is restricted from 1-10 and not more than that. They provide the way to implement the business logic and the rules in database. In database it can be implemented in the form of check constraints that checks for the rules that haven’t been followed by the programmer. Constraint also used to restrict the data that can be stored in the relations. Domain constraint can be applied to check the domain functionality and keep it safe..

8. What are the two principles of relational database model? What is the difference between them?

The two principal rules for the relational model are as follows:

- Entity integrity: this is used to maintain the integrity at entity level
- Referential integrity: it is used to maintain integrity on all the values which have been referenced.

The differences between them are as follows:

- Entity integrity tells that in a database every entity should have a unique key; on the other hand referential integrity tells that in the database every table values for all foreign keys will remain valid.
- Referential integrity is based on entity integrity but it is not the other way around.
- For example: if a table is present and there is a set of column out of which one column has parent key set then to ensure that the table doesn’t contain any duplicate values, a unique index is defined on the column that contains the parent key.

What is the difference between primary and foreign key?

- Primary key uniquely identify a relationship in a database, whereas foreign key is the key that is in other relation and it has been referenced from the primary key from other table.
- Primary key remains one only for the table, whereas there can be more than one foreign key.
- Primary key is unique and won’t be shared between many tables, but foreign key will be shared between more than one table and will be used to tell the relationship between them.

Why stored procedures are called as executable code?

Stored procedure stored inside the database. This also includes the executable code that usually collects and customizes the operations like insert, encapsulation, etc. These stored procedures are used as APIs for simplicity and security purposes. The implementation of it allows the developers to have procedural extensions to the standard SQL syntax. Stored procedure doesn’t come as a part of relational database model, but can be included in many implementations commercially.

What is an index represent in relational database model?

- Index is a way to provide quick access to the data and structure. It has indexes maintain and can be created to combine attributes on a relation. Index allows the queries to filter out the searches faster and matching data can be found earlier with simplicity.

- For example: It is same as the book where by using the index you can directly jump to a defined section. In relational database there is a provision to give multiple indexing techniques to optimize the data distribution.

What are the relational operations that can be performed on the database?

There are many relational operators that are used to perform actions on relational database. These operators are as follows:

1. Union operator that combines the rows of two relations and doesn’t include any duplicate. It also removes the duplicates from the result.
2. Intersection operator provides a set of rows that two relations have in common.
3. Difference operator provide the output by taking two relations and producing the difference of rows from first that don’t exist in second.
4. Cartesian product is done on two relations. It acts as a cross join operator.

What do you understand by database Normalization?

- Normalization is very essential part of relational model.
- Normal forms are the common form of normalization.
- It helps in reducing redundancy to increase the information overall.
- It has some disadvantages as it increases complexity and have some overhead of processing.
- It consists of set of procedures that eliminates the domains that are non-atomic and redundancy of data that prevents data manipulation and loss of data integrity.

What are the different types of normalization that exists in the database?

There are 9 normalizations that are used inside the database. These are as follows:

1. First normal form: in this table represents a relation that has no repeating groups.
2. Second normal form: non- prime attributes are not functional dependent on subset of any candidate key.
3. Third normal form: in a table every non- prime attribute is non-transitively dependent on every candidate key
4. Elementary key normal form: superkey dependency or elementary key dependency effects the functional dependency in a table.
5. Boyce codd normal form: “every non-trivial functional dependency in the table is dependent on superkey”.
6. Fourth normal form: “Every non-trivial multivalued dependency in the table is a dependent on a superkey”.
7. Fifth normal form (5NF): “Every non-trivial join dependency in the table is implied by the superkeys of the table”.
8. Domain/key normal form (DKNF): “Every constraint on the table is a logical consequence of the table's domain constraints and key constraints”.
9. Sixth normal form (6NF): “Table features no non-trivial join dependencies at all”.

How de-normalization is different from normalization?

- Analytical processing databases are not very normalized. The operations which are used are read most databases.
- It is used to extract the data that are ancient and accumulated over long period of time. For this purpose de-normalization occurs that provide smart business applications.
- Dimensional tables in star schema are good example of de-normalized data.
- The de-normalized form must be controlled while extracting, transforming, loading and processing.
- There should be constraint that user should not be allowed to view the state till it is consistent.
- It is used to increase the performance on many systems without RDBMS platform.

What is the type of de-normalization?

Non-first normal form (NFA)

– It describes the definition of the database design which is different from the first normal form.
- It keeps the values in structured and specialized types with their own domain specific languages.
- The query language used in this is extended to incorporate more support for relational domain values by adding more operators.

How many levels of data abstraction are available?

There are three levels of data abstraction available in database model and these are as follows:

1. Physical level: It is the lowest level that describes how data is stored inside the database.
2. Logical level: It is the next higher level in the hierarchy that provides the abstraction. It describes what data are stored and the relationship between them.
3. View level: It is the highest level in hierarchy that describes part of the entire database. It allows user to view the database and do the query.

What is the difference between extension and intension?

The major difference between extension and intension is that:

- Extension is time dependent, whereas intension includes a constant value.
- Extension tells about the number of tuples presented in a table at any instance, whereas intension gives the name, structure and constraint of the table.

What are its two major subsystems of System R?

System R is being developed by IBM. Its purpose is to demonstrate the possible solution to build a relational database system. The relational database system has to be such that which can interact with the real life environment to sole real life scenarios.

The two subsystems that are included in it are:

1. Research storage: This includes the research information of the database.
2. System relational system: This includes the relational data that a system has to produce and keep everything in relation.

What do you understand by Data Independence?

Data independence tells about the independence of the data inside the application. It usually deals with the storage structure and represents the ability to modify the schema definition. It doesn’t affect the schema definition which is being written on the higher level.

There are two types of data independence:

1. Physical data independence: It allows the modification to be done in physical level and doesn’t affect the logical level.
2. Logical data independence: It allow the modification to be done at logical level and affects the view level.

NOTE: Logical Data Independence is more difficult to achieve.

How view is related to data independence?

- View is a virtual table that doesn’t really exist, but it remains present so that user can view their data.
- It is derived from the base table. The view is stored in the data dictionary and represents the file directly.
- The base table updation or reconstruction is not being reflected in views.
- It is related to the logical data independence as it is at the logical level and not at the physical level.

Why E-R models are used?

E-R model stands for entity-relationship model and it is used to represent a model with their relationships. This is an object oriented approach and it is based on real world that consists of objects which are called entities and relationship between them. Entities are further used inside the database in the form of attributes.

What is the purpose of acid properties?

- ACID stands for Atomicity, Consistency, Isolation and durability and it plays an important role in the database.
- These properties allow the database to be more convenient to access and use. This allows data to be shared more safely in between the tables.
- If these properties are not being implemented then the data will become inconsistent and inaccurate.
- It helps in maintaining the accuracy of the data in the database.

What do you understand by cardinality and why it is used?

- Cardinality is important and used to arrange the data inside the database.
- It is related to the design part and need to be properly used in database.
- It is used in E-R diagrams and used to show the relationship between entities/tables.
- It has many forms like the basic is one to one, which associate one entity with another.
- Second is one to many: which relates one entity with many entities in a table.
- Third is many to many M: N that allows many entities to be related to many more.
- Last is many to one that allows the many entities to be associated with one entity.

What is the difference between DBMS and RDBMS?

- DBMS is persistent and accessible when the data is created or exists, but RDBMS tells about the relation between the table and other tables.
- RDBS supports a tabular structure for data and relationship between them in the system whereas DBMS supports only the tabular structure.
- DBMS provide uniform methods for application that has to be independently accessed, but RDBMS doesn’t provide methods like DBMS but provide relationship which link one entity with another.
SQL, Structured Query Language Interview Questions
Structured Query Language, SQL interview questions and answers for freshers and experienced - In this series, we have covered all about SQL and answered the questions that might be asked during an interview.
SQL (Structured query language) Interview Questions for Freshers
SQL Interview Questions for Freshers - What is Index?, What is Trigger?, What is a NOLOCK?, What is the STUFF function and how does it differ from the REPLACE function?, What are Self Join and Cross Join?..
Database - What is Index tuning?
Index tuning is part of database tuning for selecting and creating indexes. The index tuning goal is to reduce the query processing time......
Post your comment