You are on page 1of 3

SQL Assignment 10

1. What are different advantages of view in Oracle?


It can be used for retrieving data from complex queries by just using simple
queries.
Secondly since it is only a view of a table,so any operation on table can be
restricted.
2. Differentiate between Simple and Complex View in Oracle?
If view is created from a single table-simple view
It contains no functions or group of data and dml can also be applied.

If view is created from more than one table-complex view


It contains functions or group of data and dml can not also be applied.

3. View can contain the Structure as well as Data of the Base Table
(TRUE/FALSE).
True

4. Write the syntax to create a view (Let Say TEST_VIEW) containing the
employee number (EMPLOYEE_ID) with the alias ID_NUMBER, name
(LAST_NAME) with the alias NAME, and annual salary (SALARY) with the
alias ANN_SALARY for every employee in department 50.
create view TEST_VIEW as select employee_id "ID_NUMBER",last_name
"NAME",salary "ANN_SALARY" from employees where department_id=50;

5. In which situations we cannot remove a row from the base table through a view.
Pseudo column
Distinct keyword
Group by clause
Group fns
6. What is Pseudo-column in Oracle? Write few examples.
7. In which situations we cannot add a row from the base table through a view.
Pseudo column
Distinct keyword
Group by clause
Group fns
Columns by expressions
Not null constraint columns

8. What is the use of WITH READ ONLY option during view creation in Oracle?
It restricts applications of dmls on views.
9. When base table is dropped all of its associated views will be dropped
automatically (TRUE/FALSE).
true
10.Same sequence can be used for multiple tables belongs to different users
(TRUE/FALSE).
true
11.What is the difference between NEXTVAL and CURRVAL in a sequence?
NEXTVAL returns the next value of sequence.So the sequence makes increment
each time for getting nextval.The value returned by sequence is always unique.
CURRVAL returns the current value of sequence.
12.In which situations gap might occur in sequence value?
If system crashes or same sequence is used in different tables or rollback occurs.
13.By executing ALTER SEQUENCE statement it is possible to restart the sequence
at a different number (TRUE/FALSE).
false
14.What is the advantage of using Index in Oracle?
Rows retrieval is made faster by using index.
15.Index is used and maintained automatically by the Oracle server
(TRUE/FALSE).

true
16.What is the difference between USER_TABLES and ALL_TABLES?
USER_TABLES gives the description of user owned tables.
ALL_TABLES gives the description of tables accessible to users.

17.ALL names in the data dictionary are uppercase (TRUE/FALSE).

true
18.Which two views are used for getting information regarding constraints?
User_constraints
User_cons_columns
19.Write the syntax to drop the comment set on employees table.
Comment on table tablename is ‘ ‘;
20.Which two views are used for getting information regarding comments added on
a table?
All_tab_comments
User_tab_comments

21.Write the syntax to find the names of all synonyms that are in your schema?

Select * from user_synonyms;


22.Write the syntax to display the column name, constraint name, constraint type,
search condition, and status for DEPARTMENTS table belongs to HR schema.
select CONSTRAINT_NAME,CONSTRAINT_TYPE,SEARCH_CONDITION,
STATUS from user_constraints where table_name='DEPARTMENTS';

You might also like