DBMS_VIVA(Q&A)
DBMS_VIVA(Q&A)
2) What is DBMS?
Data definition
Update
Retrieval
Administration
6) What is SQL?
They are:
CREATE:
They are:
Joins help in explaining the relation between different tables. They also enable
you to select data with relation to data in another table.
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.
Compilation of all entries of any particular type of entry in the database is called
Entity Set.
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.
Error handling part of PL/SQL block is called Exception. They have two
types : user_defined and predefined.
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.
No duplicate entries
Saves storage space
Boasts the query performances.
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.