DMA Solvedqb
DMA Solvedqb
Chapter 3
1. Define index. Explain types of indices with proper example.
Index:
• It is database object used to speed up performance of queries.
• It can be created or dropped with no effect on data.
• There are three types of index:
1. Simple Index:
It is created on one column.
Syntax:
create index index name on table name ( column name);
Example:
Create index i1 on emp(eid);
2. Unique Index:
Unique index does not allow duplicate values.
Syntax:
create unique index indexname on tablename (columnname);
Example:
Create unique index i2 on emp(phone);
3. Composite Index:
A composite index is created on two or more columns.
Syntax:
Create index indexname on tablename (columnname1, columnname2);
Example:
Create index i3 on emp(eid, ename);
2. Define Synonym .Write syntax and example of create and drop synonym.
It is alternative name for database object such as tables, views, sequences etc.
Creating Synonym:
Syntax:
Dropping Synonym:
Syntax:
Example:
4. Create Synonym emp for employee. (iii) Drop Synonym created on employee
table.
Output:
Synonym created.
Synonym dropped.
Chapter 4
5. Enlist types of exceptions in PL/SQL.
System defined exception (Predefined exceptions)- They are executed when any
database rule is violated by a program.
User-defined exceptions - PL/SQL allows you to define your own exceptions according
to the need of your program.
System-defined:
User-defined:
7. Define Cursor .List its types.
Types of triggers:
• Row level trigger
• Statement level trigger
• After Trigger
• Before trigger
9 Differentiate between PL/SQL function and procedure. (any four differences).
Begin Section:
• We write SQL and PL/SQL executable statements in this block.
• This is compulsory block.
End:
• It indicates the termination of the code.
• This is compulsory block.
11. State any two advantages of PL/SQL.
• PL/SQL is integrated with SQL.
• PL/SQL allows sending entire block of statement to database at one time this
provides high performance.
• Applications written in PL/SQL are fully portable.
• PL/SQL provides high security level.
• Character datatype.
• Number datatype.
• Boolean datatype
• Date datatype
• LOB datatype
13. With suitable example write steps to create triggers and drop a trigger.
16. List the types of triggers. Write the steps to create trigger with example.
Types of trigger:
17.Create cursor emp_copy to select all records from employee table and copy
them into employee2 table.
insert all
into t1 values(1,'a')
into t1 values(2,'b')
select 1 from dual;
27.Consider schema ‘employee’ created by ‘user1’ Write SQL queries for following :
i) Grant ‘select’ and ‘insert’ permissions to user2. ii) Assign all privileges for the
user user3. iii) Remove ‘select’ permission from user2 for t able ‘employee’. iv)
Grant ‘update’ permission to user2 and user3 v) Remove all permission from user3
28. Explain lock based concurrency control algorithm.
30. Describe GRANT and Revoke with its syntax and example.