Showing posts with label DBMS Question Bank. Show all posts
Showing posts with label DBMS Question Bank. Show all posts

Sunday, April 25, 2021

Quick reference in database management systems

Quick reference in DBMS, Database management systems quick reference section, quick reference to multiple basic questions in DBMS, database questions and answers

Quick Reference

Is it mandatory to give value to primary key when record is inserted?

Yes. Primary key is an attribute with the following property;

PRIMARY KEY = UNIQUE + NOT NULL

Due to NOT NULL property, we need to include data for primary key attribute while inserting a record.

 

Two different ways to insert primary key in table

  1. You can include a primary key in the CREATE TABLE statement while creating a table.
  2. You can include a primary in the ALTER TABLE statement using ADD PRIMARY KEY(column(s)).

Example (Oracle SQL):

  • CREATE TABLE x (abc CHAR(10) PRIMARY KEY, xyz VARCHAR(20));
  • ALTER TABLE z ADD PRIMARY KEY(Sno);

 

3 different techniques to achieve 1nf with suitable examples

  • Reducing ER diagram into database schema
  • Flatten the records of an un-normalized table
  • Decompose an un-normalized table into one or more tables.

 

What is the name of the schema that contains definitions for schema objects in a catalog?

Data dictionary is the name of schema.

Name for data dictionary schema by various RDBMSs

  • Oracle – Data dictionary
  • MySQL – Information Schema
  • IBM DB2 – SYSCAT schema

 

What will happen if locks are released just before commit? Will other transactions interfere and acid property is affected?

If the locks on data items are released before commit, there is a possibility that the released data items values (which are uncommitted) may be consumed by other ongoing transactions (if any). This may result in inconsistent database.

 

The person involved with database design is called.

Usually DBA designs a database. In case of very large organizations, it may be divided between various DBAs with names like “database designer” or “database architect”.

 

Advantages and disadvantages of using foreign key in same table as primary key or in different table

 

Give pros and cons of lock based protocols for concurrency control

 

How to avoid lost update problem?

Let us assume two transactions A and B are working on same data item Q. If both of them are trying to update the value of Q, this will result in lost update problem. To avoid this situation, the transactions that are working on same data item must update the data item after the other transactions commit.

 

How to avoid dirty read problem?

Reading the value of a data item that was produced by an uncommitted transaction is referred as dirty read problem. This will be avoided if we permit transactions to read the values that are produced by committed transactions.

 

What is the solution for lost update and dirty read problems?

Transactions should be permitted to read/use the data items that are produced by committed transactions.

 

Where do we use BCNF? Why?

We use BCNF when there are more than one candidate keys in a table and they are overlapping.

BCNF is a stronger version of 3NF because it restricts both prime and non-prime attributes, while 3NF only restricts non-prime attributes.

 

Is deadlock prevention preferred over deadlock detection in database concurrency?

No. Deadlock prevention is costly when compared with the cost of deadlock detection. Hence, deadlock detection is preferred most of the time.

 

What's the difference between minimal cover and closure of a functional dependency?

A minimal cover of a set of functional dependencies (FDs) F is a minimal set of FDs Fmin that is equivalent to F.

Closure of set F of FDs is a set of all possible FDs (denoted as F+) that are logically implied by F. Closure is derived using Armstrong’s axioms and additional rules.

Simply put, for a set F, minimal cover includes only required number of FDs that imply F, whereas closure has redundant FDs that imply F.

 

Compare and contrast various indexing techniques in different database systems

To insert date and time in the database data type is used

How can we delete particularly a second row from a table in a single line SQL command?

 

*********************

 

 

Tuesday, September 15, 2020

Database management system ER model, normalization quiz with answers

 Solved quiz questions in RDBMS, ER model quiz questions, normalization quiz questions, questions and answers explained in dbms

Quiz Questions in DBMS - TRUE / FALSE

 

1. A many-to-many relationship R connects entity sets E and F. In an ER diagram, we can use an arrow directed towards F to indicate that R has referential integrity from E to F.

(a) TRUE                                          (b) FALSE

Answer: FALSE

Referential integrity is a constraint only added to a many-one relationship in the “one direction.”

 

2. R is a relation in 4NF. If the MD A →→ BC (A multi-determines BC) holds in R and is non-trivial, then the FD A BC holds in R.

(a) TRUE                                          (b) FALSE

Answer: TRUE

Since R is in 4NF, the MD does not violate 4NF. Therefore, A must be a superkey, from which the FD A → BC follows.

 

3. If relation R has n tuples and relation S has m tuples, min(m, n) is the maximum number of tuples that R ∩ S can contain. (Assume set-theoretic semantics.)

(a) TRUE                                          (b) FALSE

Answer: TRUE

We try to find the number of common tuples (records) between R and S. The maximum number of tuples is based on the number of tuples in each relation and the smallest relation among them. Hence, the result is the minimum(m, n).

 

4. Number of possible non-trivial multi-valued dependencies in a relation with two attributes will be 1.

(a) TRUE                                          (b) FALSE

Answer: FALSE

Zero. Any multi-valued dependency in this relation must involve both two attributes. Hence, it is trivial.

 

5. In a relation R(X, Y, Z, T), if XY Y Z then X Z.

(a) TRUE                                          (b) FALSE

Answer: FALSE

As per the augmentation rule, if we like to add an attribute or set of attributes with a functional dependency, we can do so by adding the said attribute on both sides of the given functional dependency. But, we cannot remove an attribute (or set of attributes) that exists already in a FD on both sides always. Because, in the given FD, the attribute (or set of attributes) that appear on both sides may not be redundant on LHS to determine the rest of the attributes on the RHS.

 

*******************

Related links:



Go back to DBMS Quizzes/MCQs page



Go to Normalization - Solved Exercises page


entity relationship model multiple choice questions

mcq in rdbms

solved mcq with answers explained in dbms

normalization solved questions and answers

normalization interview questions

dbms online quiz questions solved

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery