Interview Bit
Interview Bit
© Copyright by Interviewbit
Contents
18. Explain the difference between a 2-tier and 3-tier architecture in a DBMS.
RDBMS stands for Relational Database Management System and was introduced in
the 1970s to access and store data more efficiently than DBMS. RDBMS stores data in
the form of tables as compared to DBMS which stores data as files. Storing data as
rows and columns makes it easier to locate specific values in the database and makes
it more efficient as compared to DBMS.
Examples of popular RDBMS systems are MySQL, Oracle DB, etc.
Atomicity: This property reflects the concept of either executing the whole
query or executing nothing at all, which implies that if an update occurs in a
database then that update should either be reflected in the whole database or
should not be reflected at all.
Consistency: This property ensures that the data remains consistent before and
a er a transaction in a database.
Lumping both operations into a single atomic transaction ensures data integrity. This is what is called atomicity in DBMS. It is the property that a transaction is a single indivisible transaction. The individual
operations within a transaction either all have to be performed or none will be performed. If any single operation fails then the whole transaction fails. This ensures that the databases are in a valid state at
all times.
The transaction management unit of a database management system is responsible for maintaining atomicity transactions on a database.
Isolation
Suppose you and your friend are booking a train ticket for Delhi. While you check the number of seats available you find there is only a single seat available,your friend also sees the same thing from his
IRCTC app. Now, if both of you simultaneously start booking the train seat, that should not be allowed by the database management system, else either of you will land in trouble. May be both will end up
booking for the same seat, or may be both will pay but only one will have the seat confirmed.
Thus, the database should either perform your entire transaction first before executing your friend’s or vice-versa. So if your transaction is done first, then your friend will find available no. of seats as zero,
which is absolutely okay.
The concurrency control unit of a database management system is responsible for maintaining isolation among transactions on a database.
Durability
Imagine you have 10 lakh amount in your bank account. The bank database server goes down, all data stored on that server is gone and so your money is gone! So you need durability, a fault free system.
This property ensures that once the transaction has completed execution, the updates and modifications to the database are stored in and written to the disk(of the database server) and they persist
permanently even if a system failure occurs.
Organizations, such as banks and hospitals, their very existence depends on the information systems run on databases. The ability to recover 100% of all committed transactions is absolutely crucial. The
recovery rate must be 100 percent, not 90 percent or even 99.9 percent. In addition, this recovery must be permanent, meaning all transactions must be reconstructed, even if the database server crashes
due to OS failure or power loss.
The recovery management component of the database management system is responsible for maintaining durability in a database.
Consistency
Consistency means all is well, there is no incorrectness anywhere in the system. If all the three mentioned above can be guaranteed then consistency prevails. There is no separate component in a
database management software that will ensure consistency.
Durability: This property ensures that the data is not lost in cases of a system
failure or restart and is present in the same state as it was before the system
failure or restart.
The process of collecting, extracting, transforming, and loading data from multiple
sources and storing them into one database is known as data warehousing. A data
warehouse can be considered as a central repository where data flows from
transactional systems and other relational databases and is used for data analytics. A
data warehouse comprises a wide variety of organization’s historical data that
supports the decision-making process in an organization.
Physical Level: it is the lowest level and is managed by DBMS. This level
consists of data storage descriptions and the details of this level are typically
hidden from system admins, developers, and users.
Conceptual or Logical level: it is the level on which developers and system
admins work and it determines what data is stored in the database and what is
the relationship between the data points.
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.
It deletes only the rows which are specified by the WHERE clause.
It can be rolled back if required.
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 removes complete data from a table in a database.
It can be rolled back even if required.
It doesn’t maintain a log and deletes the whole table at once and hence it’s fast.
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.
Composite Key: A composite key refers to a combination of two or more
columns that can uniquely identify each tuple in a table. In the below example
the studentId and firstname can be grouped to uniquely identify every tuple in
the table.
Css Interview Questions Laravel Interview Questions Asp Net Interview Questions