33% found this document useful (18 votes)
11K views

This Study Resource Was

The document contains 14 multiple choice questions about SQL concepts like indexes, views, materialized views, synonyms, and DML statements. The questions test knowledge of how these database objects work, how SQL statements like updates affect data and performance, and the output of sample queries.

Uploaded by

Anirudh Mohanty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
33% found this document useful (18 votes)
11K views

This Study Resource Was

The document contains 14 multiple choice questions about SQL concepts like indexes, views, materialized views, synonyms, and DML statements. The questions test knowledge of how these database objects work, how SQL statements like updates affect data and performance, and the output of sample queries.

Uploaded by

Anirudh Mohanty
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

Consider the Employes table below

Emp_ld Emp_name Salary Manager_ld


10 Anil 50000 18
11 Vikas 75000 16
12 Nisha 40000 18
13 Nidhi 60000 17
14 Payal 80000 18
15 Mohit 45000 18
16 Rajesh 90000 NULL
17 Raman 55000 16
18 Santosh 65000 17

Write a query to generate below output

m
Manager_id Manager Average_Salary_Under_Manager

er as
16 Rajesh 65000

co
17 Raman 62500

eH w
18 Santosh 53750

o.
rs e
a) select b.emp_id as "Manager_id”,
ou urc
b.emp_name as "Manager",
avg(a.salary) as "Average_Salary_Under_Manager”
from Employee a,
o

Employee b
aC s

where a.manager_id=b.emp_id
vi y re

group by b.emp_id, b.emp_name


order by b.emp_id,
ed d

select b.emp_id as "Manager ld",


ar stu

b.emp_name as "Manager",
avg(b.salary) as "Average_Salary_Under_Manager”
from Employee a,
Employee b
is

where a.manager_id = b.emp_id


Th

group by emp_id, emp_name


order by b.emp_id;
sh

select a.emp_id as "Manager_id",

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
a.emp_name as "Manager”,
avg(a.salary) as "Average_Salary_Under_Manager"
from Employee a,
Employee b
where a.manager id = b.emp_id
group by b.emp_id, b.emp_name
order by b.emp_id;

b) select a.emp_id as "Manager_id",


a.emp_name as "Manager",
avg(b.salary) as "Average_Salary_Under_Manager"
from Employee a,
Employee b,
where a.manager_id = b.emp_id
group by b.emp_id, emp_name

m
order by emp_id;

er as
co
eH w
2. Rowid is the physical address which the data is stored

o.
a) TRUE rs e
ou urc
b) FALSE

3. IN and NOT IN operations decreases the performance of an SQL query compared to


o

AND/OR operations. Is it True or False ?


aC s
vi y re

a) FALSE
b) TRUE
ed d

4. Indexes enhance the performance even if the table is updated frequently


ar stu

a) True
b) False

5. What would be the output of below SQL statement select empName from Employee order by
is

2 desc,
Th

a) Displays empName in ascending order


b) Display empName in descending order
c) Displays 0 records
sh

d) Produce an error

6. Which privilege from the following is used to create a private synonym in another user's
schema?

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
a) CREATE ANY SYNONYM
b) CREATE PUBLIC SYNONYM
c) None of the above
d) CREATE SYNONYM

7. Views stores the data and you can refresh it on timely basis
a) True
b) False

8. How non clustered index help to fetch data?


a) None of the above
b) It points to a data row
c) It never points to anything

m
d) It is used for pointing data rows containing key values

er as
co
9. Rownum numbers the records in a result set

eH w
a) False

o.
b) True
rs e
ou urc
10. Multiple updates in a table will decrease the performance
a) True
b) False
o
aC s
vi y re

11. What will be the output of the below query given an Employee table having 10 records?

DROP TABLE Employees


ed d

ROLLBACK
ar stu

SELECT * FROM Employees

a) Produce an error
b) 100 records
is

c) 10 records
Th

d) 0 records
sh

12. How the parameter atomic_refresh in dbms_mview.refresh will make the refresh faster?

a) When atomic_refresh is set to FALSE, the materialized view is deleted with DROP
command

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
b) When atomic refresh is set to TRUE the materialized view is deleted with DELETE
command
c) When atomic refresh is set to FALSE, the materialized view is deleted with TRUNCATE
command
d) When atomic refresh is set to TRUE, the materialized view is deleted with TRUNCATE
command

13. During MV Complete Refresh, users can use the materialized views and see the old data
a) True
b) False

14. Consider the table binary_tab

Col1 Col2

m
10

er as
01

co
01

eH w
11

o.
10
01 rs e
ou urc
00
10
o

What would be the output of


aC s

select * from binary tab


vi y re

after executing the below update statement


update binary_tab set col2 = case when col1 = 1 then 0 else 1 end;
ed d
ar stu

a) Col1 Col2
10
01
01
is

10
Th

10
01
01
10
sh

b) Col1 Col2
10
11
11
11

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
10
11
10
10

c) Col1 Col2
10
01
01
11
10
01
00
10

m
d) Col1 Col2

er as
10

co
00

eH w
00

o.
10
10 rs e
ou urc
00
00
10
o
aC s

15. What are composite indexes ?


vi y re

a) Composite index can never be created


b) A composite index is a combination of index on 2 or more columns
ed d

c) Are those which are composed by database for its internal use
ar stu

d) None of the mentioned


is
Th

16. Consider the below table


sh

id name dept
1 Veena 5
2 Vani 6
3 NULL 5

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
4 Veda 7

What would be the output of below query

Select id,NVL(name, ‘XYZ_NONAME’, name) dept from emp;

a) 1 Veena
2 Vani
3 NULL
4 Veda

b) id name
1 Veena
2 Vani
3 XYZ_NONAME

m
4 Veda

er as
co
c) None of the above

eH w
o.
d) id name
1 XYZ_NONAME rs e
ou urc
2 XYZ_NONAME
3 XYZ_NONAME
4 XYZ_NONAME
o
aC s

17. How to concatenate multiple rows into a single string in sql


vi y re

a) None of the above


b) COALESCE
ed d

c) STRING_AGG
ar stu

d) option 1 & 2

18. Views are created on top of Materialized Views


a) True
is

b) False
Th

19. Which database link or PL SQL subprograms in the schema can use this link to access
database objects in the corresponding remote database
sh

a) Public
b) Global
c) Self
d) Private

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
20. Materialized views stores the data and you can refresh it on timely basis
a) True
b) False

21. ALL_SOURCE will help us to

a) Displays the objects in the database


b) Describes the text source of all stored objects in the database
c) None of the above
d) Describes the text source of the stored objects accessible to the current user

22. Consider the below scenario


(There are 2 tables EMP, DEPT
EMP have details (id, name, salary, deptid etc ) About the employee.

m
DEPT have details like deptid, deptname depthead, etc

er as
How do you display employee records who gets more salary than the average salary in the

co
department?

eH w
o.
a) SELECT * FROM employees WHERE (salary,dept id )> ALL (SELECT avg(salary),
rs e
dept_id FROM employees GROUP BY dept_id)
ou urc
b) None of the above
c) SELECT * FROM employees WHERE salary > (SELECT avg(salary), dept_id FROM
employees GROUP BY dept_id).
o

d) Select e1.*
aC s

from employees e ,employees e1


vi y re

where (e.salary e.dept_id) in (SELECT avg(salary), dept_id FROM employees GROUP


BY dept_id)
and e1.salary >e.salary
ed d

and e1.dept_id=e.dept_id;
ar stu
is
Th

23. Consider the below table:


Select SAL FROM EMP;
sh

ID
-------
1000
200
3000

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
40
500

What will be the output of below snippet?

Select SUM(1) FROM "Test".EMP";


Select SUM(2) FROM "Test"."EMP";
Select SUM(3) FROM "Test"."EMP";

a) 9240
9240
9240
b) It will produce an error
c) 5000
1000

m
15000

er as
d) 1000

co
200

eH w
3000

o.
24. Consider the below scenariors e
ou urc
Schema 'SCH1' contains 1_Tab1,1_Tab2 ;
Schema 'SCH 2' has 2_sch2,1_sch2;
Schema 'SCH3' doesn't have any tables
o

What kind of access 'SCH1 can provide to SCH2, so that SCH2 can give same access to SCH3
aC s
vi y re

a) None of the above


b) GRANT
c) GRANT WITH GRANT
ed d

d) REVOKE
ar stu

25. Total no of rows from a cartesian product and FULL OUTER JOIN is always same

a) True
is

b) False
Th
sh

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
m
er as
co
eH w
o.
rs e
ou urc
o
aC s
vi y re
ed d
ar stu
is
Th
sh

This study source was downloaded by 100000825932877 from CourseHero.com on 05-13-2021 03:41:47 GMT -05:00

https://www.coursehero.com/file/67084057/Oracle-SQLdocx/
Powered by TCPDF (www.tcpdf.org)

You might also like