Advanced DBMS Viva :: New Edition
Advanced DBMS Viva :: New Edition
Relational model
Hierarchical model
Document model
#5 What is ER modeling?
ER model of employees
#6 What is NoSQL?
ACID stands for Atomicity, Consistency, Isolation,
and Durability. In order to maintain consistency of a database,
before and after the transaction, these four conditions must be
met. Below, I try to briefly describe the concept.
Atomicity: It is also known as “all or nothing rule”. Basically
either all parts of a transaction are stored or none of them is
stored. No partial transaction is allowed. For example, if a
transaction is to take money from an account and deposit it into
another account, all parts of it must be completed for a database to
stay consistent. If we do this transaction partially, then we made
our database inconsistent.
Typically the operations that need the whole row are writing
operations like INSERT, DELETE, UPDATE. The operations that need
columns are typically read operations like SELECT, GROUP BY, JOIN ,
etc.
OLTP and OLAP are both online processing systems. OLTP stands
for “Online Transaction Processing” and it is a system that
manages transaction-oriented applications, and OLAP stands for
“Online Analytical Processing”, and it is a system to manage
analytical queries.
Concurrency control
In general, it is fair to say that locks are mostly used to ensure that
only one user/session is allowed to update a particular data. Here I
describe two types of locks: shared lock (S) and exclusive lock (X).
These locks can be held on a table, a page, an index key, or an
individual row.
Access methods
Access methods are organization techniques or data structures
that support fast access to subsets of rows/columns. Some of the
most common data structures are variants of hash tables and B-
trees.
Advantages:
Disadvantages:
There are situations that hashing is not necessarily the
best option. For example, for small data, the cost of a
good hash function makes hashing more expensive than
a simple sequential search.
operator execution
Crash Recovery
Crash recovery is the process to roll back to a consistent and
usable state. This is done by undoing incomplete transactions and
redoing committed transactions that were still in memory when
the crash occurred
Two are two ways that a table can be partitioned: horizontally and
vertically. Vertical partitioning puts different columns into
different partitions, whereas horizontal partitioning puts subset of
rows in different partitions based on a partition key. For example,
a company’s sale records can be horizontally partitioned based on
the sale date.
#32 What is database sharding?
If you want to learn more about it, you can refer to this article
(here).
The VIEW results are not stored on the disk, and every time a
VIEW is run, we get updated results. However, in materialized
VIEW, things are different. We store the results on the disk and we
put some mechanism in place to keep them updated (a.k.a VIEW
maintenance).
Both clauses are used to limit the result set by providing some
conditions to filter the rows from the result set. However, there is
one difference. WHERE clause scans the raw data (row by row) to
check the conditions and filter them, but HAVING scans the
aggregated results to check the conditions and filter them. For this
reason, HAVING comes after GROUP BY in the SQL query. In
summary, WHERE filters the raw data, but HAVING filters the
processed data.
The next step is to introduce primary key and foreign key. In this
step, we divide the 1NF tables further and create new tables and
connect them through primary and foreign keys. If in these new
tables, all non-key attributes be fully functional dependent on the
primary key, then we reach to 2nd normal form (2NF)
There are two types of integrity rules that if we obey them, we can
maintain our database consistency. Entity rule and Referential
rule. Entity rule is related to our primary key, if we make a column
the primary key, then it can not have any NULL value. Referential
rule is related to our foreign keys, our foreign keys must either
have a NULL value or their values must be the primary key of
another table.
You can see the whole process of using a cursor in the below
example.