0% found this document useful (0 votes)
17 views

DBMS_VIVA(Q&A)

The document provides an overview of databases, including definitions of key concepts such as Database Management Systems (DBMS), database models, SQL, and various types of keys. It explains the functionalities of database languages, normalization, and the differences between primary and unique keys, as well as commands like DDL and DML. Additionally, it discusses relationships in databases, the purpose of triggers, and the levels of data abstraction in DBMS.

Uploaded by

grojamani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

DBMS_VIVA(Q&A)

The document provides an overview of databases, including definitions of key concepts such as Database Management Systems (DBMS), database models, SQL, and various types of keys. It explains the functionalities of database languages, normalization, and the differences between primary and unique keys, as well as commands like DDL and DML. Additionally, it discusses relationships in databases, the purpose of triggers, and the levels of data abstraction in DBMS.

Uploaded by

grojamani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

1) Define Database.

A prearranged collection of figures known as data is called database.

2) What is DBMS?

Database Management Systems (DBMS) are applications designed especially


which enable user interaction with other applications.

3) What are the various kinds of interactions catered by DBMS?

The various kind of interactions catered by DBMS are:

 Data definition
 Update
 Retrieval
 Administration

4) What are the features of Database language?

A database language may also incorporate features like:


DBMS-specific Configuration and management of storage engine
Computations to modification of query results by computations, like summing,
counting, averaging, grouping, sorting and cross-referencing Constraint
enforcement Application Programming Interface

5) Define database model.

A data model determining fundamentally how data can be stored, manipulated


and organised and the structure of the database logically is called database
model.

6) What is SQL?

Structured Query Language (SQL) being ANSI standard language updates


database and commands for accessing.

7) Enlist the various relationships of database.

The various relationships of database are:


 One-to-one: Single table having drawn relationship with another table
having similar kind of columns.
 One-to-many: Two tables having primary and foreign key relation.
 Many-to-many: Junction table having many tables related to many
tables.

8) Define DDL and DML.

Managing properties and attributes of database is called Data Definition


Language(DDL).

Manipulating data in a database such as inserting, updating, deleting is defined


as Data Manipulation Language. (DML)

9. Enlist some commands of DDL.

They are:

CREATE:

Create is used in the CREATE TABLE statement. Syntax is:


CREATE TABLE [column name] ( [column definitions] ) [ table parameters]
ALTER:
ALTER objecttype objectname parameters.
DROP:

It destroys an existing database, index, table or view. Its syntax is:


DROP objecttype objectname.
10) Define cursor.

A database object which helps in manipulating data row by row representing a


result set is called cursor.

11) Enlist the cursor types.

They are:

 Dynamic: it reflects changes while scrolling.


 Static: doesn’t reflect changes while scrolling and works on recording of
snapshot.
 Keyset: data modification without reflection of new data is seen.
12) Enlist the types of cursor.

They types of cursor are:

 Implicit cursor: Declared automatically as soon as the execution of SQL


takes place without the awareness of the user.
 Explicit cursor: Defined by PL/ SQL which handles query in more than one
row.

13) Define sub-query.

A query contained by a query is called Sub-query.

14) Why is group-clause used?

Group-clause uses aggregate values to be derived by collecting similar data.

15) Define Aggregate functions.

Functions which operate against a collection of values and returning single


value is called aggregate functions

Aggregate functions: sum(),avg(),count(),min(),max() ,etc

16) Define Join and enlist its types.

Joins help in explaining the relation between different tables. They also enable
you to select data with relation to data in another table.

The various types are:

 INNER JOINs: Blank rows are left in the middle while more than equal to
two tables are joined.
 OUTER JOINs: Divided into Left Outer Join and Right Outer Join. Blank
rows are left at the specified side by joining tables in other side.

Other joins are CROSS JOINs, NATURAL JOINs, EQUI JOIN and NON-EQUI JOIN.

17) Define Entity.

It can be defined as being a ‘thing’ with an independent existence in the real


world.
18) What do you mean by Entity type?

A set of entries having similar attributes are entity types.

19) Define Entity Set.

Compilation of all entries of any particular type of entry in the database is called
Entity Set.

20) Explain different types of keys in a database.

There are mainly 7 types of keys in a database:

 Candidate Key: The candidate key represents a set of properties


that can uniquely identify a table. Each table may have multiple
candidate keys. One key amongst all candidate keys can be chosen
as a primary key. In the below example since studentId and
firstName can be considered as a Candidate Key since they can
uniquely identify every tuple.
 Super Key: The super key defines a set of attributes that can
uniquely identify a tuple. Candidate key and primary key are
subsets of the super key, in other words, the super key is their
superset.

 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.
21. What is PL SQL ?
 PL SQL is a procedural language which has interactive SQL, as well as
procedural programming language constructs like conditional branching
and iteration.
 22) Differentiate between % ROWTYPE and TYPE RECORD.
 % ROWTYPE is used when a query returns an entire row of a table or
view.
 TYPE RECORD, on the other hand, is used when a query returns column
of different tables or views.

23. Explain uses of cursor.

 Cursor is a named private area in SQL from which information can be


accessed. They are required to process each row individually for queries
which return multiple rows.

 24.Q) Explain the uses of database trigger.

 A PL/SQL program unit associated with a particular database table is


called a database trigger. It is used for :

 1) Audit data modifications.

 2) Log events transparently.

 3) Enforce complex business rules.

 4) Maintain replica tables

 5) Derive column values

 6) Implement Complex security authorizations

25.Q) What are the two types of exceptions.

 Error handling part of PL/SQL block is called Exception. They have two
types : user_defined and predefined.

26Q)What is the basic structure of PL/SQL?


PL/SQL uses BLOCK structure as its basic structure. Each PL/SQL program
consists of SQL and PL/SQL statement which form a PL/SQL block.

PL/SQL block contains 3 sections.


1. The Declaration Section (optional)
2. The Execution Section (mandatory)
3. The Exception handling Section (optional)

Q) 27.What
is the difference between FUNCTION,
PROCEDURE in PL/SQL?
 Function: The main purpose of a PL/SQL function is generally to
compute and return a single value. A function has a return type in
its specification and must return a value specified in that type.

 Procedure: A procedure does not have a return type and should


not return any value but it can have a return statement that simply
stops its execution and returns to the caller. A procedure is used to
return multiple values otherwise it is generally similar to a function.

28) Define Normalization.

Organized data void of inconsistent dependency and redundancy within a


database is called normalization.

29) Enlist the advantages of normalizing database.

Advantages of normalizing database are:

 No duplicate entries
 Saves storage space
 Boasts the query performances.

30) Define Denormalization.

Boosting up database performance, adding of redundant data which in turn


helps rid of complex data is called denormalization.

31) What are the main differences between Primary key and Unique
Key?
Answer: Given below are few differences:
 The main difference between the Primary key and Unique key is
that the Primary key can never have a null value while the
Unique key may consist of null value.
 In each table, there can be only one primary key while there can
be more than one unique key in a table.
32)What is the use of DROP command and what are the differences
between DROP, TRUNCATE and DELETE commands?
 Answer: DROP command is a DDL command which is used to
drop/delete the existing table, database, index or view from the
database.
 The major difference between DROP, TRUNCATE and DELETE
commands are:
 DROP and TRUNCATE commands are the DDL commands which are
used to delete tables from the database and once the table gets
deleted, all the privileges and indexes that are related to the table also
get deleted. These 2 operations cannot be rolled back and so should be
used only when necessary.
 DELETE command, on the other hand, is a DML Command which is
also used to delete rows from the table and this can be rolled back.
33) What are the different levels of abstraction in the DBMS?
Answer: There are 3 levels of data abstraction in the DBMS.
They include:
 Physical Level: This is the lowest level of the data abstraction
which states how the data is stored in the database.
 Logical Level: This is the next level of the data abstraction
which states the type of the data and the relationship among the
data that is stored in the database.
 View Level: This is the highest level in the data abstraction
which shows/states only a part of the database.

34) What is the purpose of normalization in DBMS?


Database normalization is the process of organizing the attributes of the
database to reduce or eliminate data redundancy (having the same data but
at different places).
Purpose of normalization:
It is used to remove duplicate data and database anomalies from the
relational table.
Normalization helps to reduce redundancy and complexity by examining new
data types used in the table.
It is helpful to divide the large database table into smaller tables and link
them using relationships.
It avoids duplicate data or no repeating groups into a table.
It reduces the chances for anomalies to occur in a database.

35) What is 1NF in the DBMS?


Answer: 1NF is known as the First Normal Form.
This is the easiest form of the normalization process which states that
the domain of an attribute should have only atomic values. The objective of
this is to remove the duplicate columns that are present in the table.
36) What is 2NF in the DBMS?
Answer: 2NF is the Second Normal Form.
Any table is said to have in the 2NF if it satisfies the following 2 conditions:
 A table is in the 1NF.
 Each non-prime attribute of a table is said to be functionally
dependent in totality on the primary key.
37) What is 3NF in the DBMS?
Answer: 3NF is the Third Normal Form.
Any table is said to have in the 3NF if it satisfies the following 2 conditions:

 A table is in the 2NF.


 Each non-prime attribute of a table is said to be non-transitively
dependent on every key of the table.
38) What is BCNF in the DBMS?
Answer: BCNF is the Boyce Codd Normal Form which is stricter than the
3NF.
Any table is said to have in the BCNF if it satisfies the following 2 conditions:

 A table is in the 3NF.


 For each of the functional dependency X->Y that exists, X is the
super key of a table.
39) What are the different type of relationships in the DBMS?
Answer: Relationships in DBMS depicts an association between the
tables.
Different types of relationships are:
 One-to-One: This basically states that there should be a one-to-
one relationship between the tables i.e. there should be one
record in both the tables. Example: Among a married couple,
both wife and husband can have only one spouse.
 One-to-Many: This states that there can be many relationships
for one i.e. a primary key table hold only one record which can
have many, one or none records in the related
table. Example: A Mother can have many children.
 Many-to-Many: This states that both the tables can be related
to many other tables. Example: One can have many siblings and
so do they have.
40) What is a Trigger?
A Trigger is a code associated with insert, update or delete operations. The
code is executed automatically whenever the associated query is executed
on a table. Triggers can be useful to maintain integrity in the database.

You might also like