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

PLSQL Questions

Views are virtual tables that contain a subset of data from one or more underlying tables and take up less storage space. Indexes allow faster retrieval of records from tables by creating an entry for each value. There are three types of indexes: unique, clustered, and nonclustered. A cursor enables traversal over table rows and acts as a pointer. Stored procedures consolidate multiple SQL statements that can be executed whenever required. Triggers automatically execute code in response to events on tables or views to maintain integrity. Clustered indexes alter the physical row storage while nonclustered indexes maintain the logical order. Stored procedures modularize code and improve performance but utilize more database memory.

Uploaded by

Anusha Kawri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

PLSQL Questions

Views are virtual tables that contain a subset of data from one or more underlying tables and take up less storage space. Indexes allow faster retrieval of records from tables by creating an entry for each value. There are three types of indexes: unique, clustered, and nonclustered. A cursor enables traversal over table rows and acts as a pointer. Stored procedures consolidate multiple SQL statements that can be executed whenever required. Triggers automatically execute code in response to events on tables or views to maintain integrity. Clustered indexes alter the physical row storage while nonclustered indexes maintain the logical order. Stored procedures modularize code and improve performance but utilize more database memory.

Uploaded by

Anusha Kawri
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. What is a View?

(PL/SQL)

A view is a virtual table which consists of a subset of data contained in a table.


Views are not virtually present, and it takes less space to store.
View can have data of one or more tables combined, and it is depending on the
relationship.

2. What is an Index?(PL/SQL)

An index is performance tuning method of allowing faster retrieval of records from


the table.
An index creates an entry for each value and it will be faster to retrieve data.

3. What are all the different types of indexes?(PL/SQL)

There are three types of indexes

Unique Index.
This indexing does not allow the field to have duplicate values if the column is
unique indexed.
Unique index can be applied automatically when primary key is defined.

Clustered Index.
This type of index reorders the physical order of the table and search based on the
key values.
Each table can have only one clustered index.

NonClustered Index.
NonClustered Index does not alter the physical order of the table and maintains
logical order of data.
Each table can have 999 nonclustered indexes.

4. What is a Cursor?(PL/SQL)

A database Cursor is a control which enables traversal over the rows or records in
the table.
This can be viewed as a pointer to one row in a set of rows.
Cursor is very much useful for traversing such as retrieval, addition and removal
of database records.

5. What is a stored procedure?(PL/SQL)

Stored Procedure is a function consists of many SQL statement to access the


database system.
Several SQL statements are consolidated into a stored procedure and execute them
whenever and wherever required.

6. What is a trigger?(PL/SQL)

A DB trigger is a code or programs that automatically execute with response to some


event on a table or view in a database.
Mainly, trigger helps to maintain the integrity of the database.

Example: When a new student is added to the student database,


new records should be created in the related tables like Exam, Score and Attendance
tables.

7. What is the difference between Cluster and Non-Cluster Index?(PL/SQL)


Clustered index is used for easy retrieval of data from the database by altering
the way that the records are stored.
Database sorts out rows by the column which is set to be clustered index.

A nonclustered index does not alter the way it was stored but creates a complete
separate object within the table.
It point back to the original table rows after searching.

8. Advantages and Disadvantages of Stored Procedure?(PL/SQL)

Stored procedure can be used as a modular programming � means create once, store
and call for several times whenever required.
This supports faster execution instead of executing multiple queries.
This reduces network traffic and provides better security to the data.

Disadvantage is that it can be executed only in the Database and utilizes more
memory in the database server.

You might also like