A database is an organized collection of data, generally stored and accessed electronically from a computer system. Where databases are more complex they are often developed using formal design and modeling techniques. Here is a list of coding interview questions on Databases to help you get ready for your next data structures interview in 2021.
- 1.
What is Normalization?
Answer:
It is the process of eliminating redundant data and maintaining data dependencies.
Source: github.com/dhaval1406 - 2.
What are the advantages of NoSQL over traditional RDBMS?
Answer:
NoSQL is better than RDBMS because of the following reasons/properities of NoSQL:
- It supports semi-structured data and volatile data
- It does not have schema
- Read/Write throughput is very high
- Horizontal scalability can be achieved easily
- Will support Bigdata in volumes of Terra Bytes & Peta Bytes
- Provides good support for Analytic tools on top of Bigdata
- Can be hosted in cheaper hardware machines
- In-memory caching option is available to increase the performance of queries
- Faster development life cycles for developers
Still, RDBMS is better than NoSQL for the following reasons/properties of RDBMS:
- Transactions with ACID properties - Atomicity, Consistency, Isolation & Durability
- Adherence to Strong Schema of data being written/read
- Real time query management ( in case of data size < 10 Tera bytes )
- Execution of complex queries involving join & group by clauses
Source: stackoverflow.com - 3.
Define ACID Properties
Answer:
- Atomicity: It ensures all-or-none rule for database modifications.
- Consistency: Data values are consistent across the database.
- Isolation: Two transactions are said to be independent of one another.
- Durability: Data is not lost even at the time of server failure.
Source: github.com/chetansomani - 4.
What is Denormalization?
Answer:
It is the process of improving the performance of the database by adding redundant data.
Source: github.com/dhaval1406 - 5.
What are the difference between clustered and a non-clustered index?
Answer:
- A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
- A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
Source: github.com/dhaval1406 - 6.
How a database index can help performance?
Answer:
The whole point of having an index is to speed up search queries by essentially cutting down the number of records/rows in a table that need to be examined. An index is a data structure (most commonly a B- tree) that stores the values for a specific column in a table.
Source: stackoverflow.com