You are on page 1of 15

1. Select 1,2 from dual union all select 1,2 from dual. How many rows will it display?

2 Rows Answer

2. BFILE max size?


4GB Answer

3. What is the maximum length of varchar2()?


4000 Bytes Answer

4. Statement to delete the table and release the space


DROP table <table name> PURGE Answer

5. Which function does not come under DML?


a. Truncate Answer
b. update
c. delete
d. merge

6. Full outer join combines the result of the both left outer join and right outer join
a. true Answer
b. false

7. To get full outer join results which one is used?


a. left outer union right outer Answer
b. left outer minus right outer

8. Natural is same as equi join.


a. True
b. false Answer

9. Which one is used to prevent the updating of records from more than one user
a. lock Answer
b. commit
c. rollback

10. Select 1, 5 from dual minus select 1,5 from dual?


Answer:- no rows selected

11. The max size of char is


Answer 2000 Bytes

12. Natural join is not same as equi/Inner join


a. True Answer
b. False

13. A self join is a one in which the table joins to itself


a. True Answer
b. false

14. An inner join (between two tables) is predicted based on the join condition
a. true Answer
b. false

15. Which data dictionary view shows all integrity constraints


a. user_view
b. all_view
c. dba_view
d. all of the above Answer

16. Which constraint disallows duplicate values and null values in the column?
a. Unique constraint
b. primary key constraint Answer
c. foreign key constraint
d. Check constraint

17. Which is true?


a. create sequence seq1 increment by 0;
b. create sequence seq1 increment by 1.5;
c. create sequence seq1 increment by -3 Answer
d. all of the above
e.
18. Syntax to enable existing constraint?
Answer:- ALTER TABLE table_name ENABLE CONSTRAINT constraint_name

19. Do change in order of the join condition changes the query result?
a. True
b. false Answer

20. Is inner join is simple join?


a. Answer True
b. False
21. Is inner join is also called self join?
a. True
b. False Answer

22. select decode(substr(technology),2,3),ch,True,False) from dual; True / False / No result


SQL> select decode(substr('TECHNOLOGY',2,3),'CH','PASS','FAIL') from dual;

DECO
----
Answer FAIL

23. If A table have 5 rows, B table have 1 row, then select * from A,B?
Answer:- 5 rows

24. If A table have 5 rows, B table have 0 rows then, Cartesian product of A and B is?
Answer:- no rows selected

25. Alternate for if?


Answer Decode
nullif
Coalesce

26. Subquery?
Answer :- Used to retrieve the data based on unknown conditions

27. What data type we will use for loop


a. Long
b. Float
c. ROWID
d. PLS_INTEGER Answer
e.
28. A table has 2 rows, b table has 3 rows. select * from a,b?
Answer:- 6

29. For a table default unique index created on ?


a. unique and primary key Answer
b. check and primary
c.
30. For a temporary table which is not true?
a. partition and index cannot be created
b. partition and index can be created Answer
31. round(15.193,-1) ?
Answer:- 20

32. Select last name, salary, dept id from a where dept id=null. Will the above query will return
whose dept id is null?
a. it will return the expected result
b. the where condition needs to be changed Answer
c. the where condition operator needs to changed

33. In which dictionary you will see whether you are having access for a particular column in table
a. SYS_TAB_PRIVS
b. SYS_COL_PRIVS
c. SYS_ROLE_PRIVS
Answer USER_COL_PRIVS or DBA_COL_PRIVS. Don’t see the above options in sql. If only the
above options are available, then go for SYS_COL_PRIVS

34. Which one will return the common records from both the table?
Answer:- INTERSECT

35. To get full outer join results which one is used?


a. left outer union right outer Answer
b. left outer minus right outer

36. Select NULL || 'ORACLE' from dual;


Answer:- ORACLE

37. Select NULL + 5 from dual;


Answer:- Null

38. Can primary key consist of more than one column?


Answer: Yes

39. Can more than one primary key be possible for a table?
Answer: No

40. Create table of oracle used to create


a. relational table and object table Answer
b. relational table
c. object table
d. xml table

41. If I need to store image & their details in database which datatype is used?
Answer Blob

42. I am giving granting all permission to person 'X'. What operations he can’t do?
a. Insert
b. Update
c. Delete
d. Truncate Answer

43. If I am giving grant permission to some 'X' for view alone which among the following is possible?
a. He can query that view
b. He can’t be able to access that view
c. He can access view alone but not source table Answer
d. None of the above

44. Select round(45.963,-1) and trunc(45.963,2) from dual;


a. 46 & 45
b. 45 & 45.96
c. 46 & 45.96
d. 50 & 45.96 Answer

45. A natural join is the one which take the matching columns from two tables?
Answer True
false
46. A merge statement can be used in case of
a. Insert
b. Update
c. Insert and Update Answer
d. None

47. The sub query following a where clause will be?


a. correlated sub query
b. Inline
c. Nested sub query Answer
d. None
e.
48. Which among the following belongs to the type of outer join?
a. left
b. right
c. full
d. All Answer
e.
49. Can oracle table allows Boolean data type?
Answer No

SQL> create table temp1111(a boolean);


create table temp1111(a boolean)
*
ERROR at line 1:
ORA-00902: invalid datatype

SQL>
50. Where we are using inline view?
Answer:- from clause

SELECT *
FROM ( SELECT deptno, count(*) emp_count
FROM emp
GROUP BY deptno ) emp,
dept
WHERE dept.deptno = emp.deptno;

51. Operations which can be done in multiple row sub query?


Ans : NOT IN (We can't do <> , = )

52. Select * from a, b?


Answer :- number of rows in a * number of rows in b

53. How many columns can be there in the table?


Answer : 1000

54. Table can't have more than one unique key?


Answer :- FALSE

55. Unique Index?


Answer:- Won’t accept same value for the column in two rows

56. Column in a table can be set as UNUSED?


Answer:- TRUE

ALTER TABLE hr.admin_emp SET UNUSED (hiredate, mgr);


57. Statement to remove the constraint from child tables if it is removed from parent tables?
Answer:- CASCADE

58. Query to get year from sysdate?

Answer:- select to_char(SYSDATE,'YYYY') from dual;

59. Value which can be stored in a field with data type number (8, 2)?
Answer:- 999999.99

60. Table which has the column with values 10,20,NULL,NULL,30. Output of select count(COLUMN)
from table?
Answer:- 3
SQL> SELECT COUNT(*) FROM EMP;

COUNT(*)
----------
12

SQL> SELECT COUNT(COMM) FROM EMP;

COUNT(COMM)
-----------
3

SQL>
61. Single row subquery?
Answer:- can return one row with multiple columns

62. Create table tablename (fieldname char) Is this throw error


Answer:- : It won’t throw error

63. Select * from emp e, dept d where e.deptno=d.deptno?


Answer:- SELECT, Projection, Join

64. Max number of CHECK constraints, column can have? (Checked for 264 checks on single column,
it worked)

a)250
b)255
c)254
d) none Answer
65. When does foreign key constraint enforce domain integrity ===>
Answer During INSERT & UPDATE IN FOREIGN TABLE & DELETE IN PARENT TABLE

66. Multiple row comparision operator ===>


Answer ALL ,ANY ,IN

67. select 1 from dual


minus
select 'a' from dual
Output?

Answer:-
select 1 from dual
*
ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression

68. insert into XYZ values(1,2,3) –


Answer Can’t answer unless we have complete XYZ table structure

69. create table ABC(sno char(1));


Rollback
what happens to the row inserter into table XYZ?
Answer No impact. The rows gets inserted successfully

70. Which clause on merge statement is used to specify the source of the data to be updated or
inserted ===>
Answer USING Clause

71. A join is a query that combines rows from only one table ===>
Answer FALSE

72. Which operator is used with a multiple row sub query ===>
Answer NOT IN

73. Inner join is equal to equijoin ===>


Answer NO (BUT VICEVERSA IS TRUE)
Almost every join is an equijoin, because the condition for matching rows is based on
the equality of two values—one from each of the tables being joined. So that's what
makes it an equijoin: the ON condition is equality. This includes inner joins and all three
types of outer joins.
74. An inner join is also called simple join ===>
Answer YES

75. Select e.named.deptid from emp edept d where e.dept id(+) = d.dept id ===>
Answer RIGHT OUTER JOIN
where t1.sub_item_cd = t2.sub_item_cd(+) -- means left outer join

76. Can a unique key contain more than one columns ===>
Answer YES

77. A table can have only one primary key ===>


Answer YES

78. What you need to specify to drop all referral integrity constraints that refer to primary and
unique keys in the dropped table ===>
Answer Foreign Key constraint

79. Which of the following sql functions can operate on any datatype ===>
Answer LPAD

80. Which data type can be used for loop counters ===>
Answer PLS_INTEGER

81. Which sql function can be used instead of IFCONSTRUCT?


Answer DECODE

82. Select round (trunc (mod (1600,10),-1),2) from dual;


a. 0 Answer
b. 1
c. 2
d. Error

83. maximum no of components in the decode function, including expr, searches, results and
default  is
a. 265
b. 250
c. 255 Answer
d. 275

84. Which operator used to comment a single line in a query?


Answer Single line comment -> --

Multi line comment -> /* */

85. oracle server creates an index for 


A) NOT NULL & PRIMARY KEY 
B) PRIMARY & FORIEN KEY
C) CHECK & UNIQUE 
D) UNIQUE & PRIMARY KEY Answer

86. Which of the following sql operator takes results of two queries and return only rows that are
appear in both results sets?
A) INTERSECT Answer
B) UNION
C) EXCEPT
D) NONE OF THE ABOVE

87. sub query can be used to 


A) sort data
B) convert data
C) retrieve data based on a condition Answer
D) all of the above

88. in------join predicate arises implicitly by comparing all columns in both the tables that have same
col name in the joined tables?
A) equi join
B) inner join
C) outer join
D) natural join Answer

89. Select 1,2 from dual union all select 1,2 from dual; result
A) 1 row
B) 2 rows Answer
C) 0 rows
D) error

90. union all returns


A) all rows Answer
B) matching rows
C) left rows
D) right rows
91. create table dept (col1 varchar2 (10));
Rollback;
DESC dept;
Answer Table gets created as it is auto commit statement

92. when does a check constraint enforce domain integrity?


A) during insert Answer
B) during delete
C) during select 
D) during optimization

93. which statement does not apply exclusive lock on dB objects?


A) alter Answer
B) update
C) insert
D) Select
Exclusive licks on db objects can occur only for DML

94. A table can't have more than one unique key?


A) true
B) false Answer

95. create table tabl (col1 long,col2 long);


Table creates or not?
Answer
SQL> create table tabl (col1 long,col2 long);
create table tabl (col1 long,col2 long)
*
ERROR at line 1:
ORA-01754: a table may contain only one column of type LONG

96. A long column can store data upto


A) 2 mega bytes
B) 2 gigabyte Answer 
C) 2000 bytes
D) none of the above

97. how many columns can be created in a oracle 10 table?


A) 255
B) 1000 Answer
C) 10000
D) no limit

98. Data type is stored as an external file observer?


A.BLOB
B.NLOB
C.BFILE Answer
D.CLOB

99. We have two tables; in which parent table will be participate in this?
A.reference key
B.foreign key
C.primary key Answer
D.check constraint

100. Subquery is formed based on?


A. Only single table
B. More than one table Answer
C. None
D. Not sure

101. nvl2(exp1,exp2,exp3) what is the output if not null for exp1 ?


A. Exp2 Answer
B.exp3
C.none
D.exp1

102. inserted data into table emp


Rollback emp
What will happen ?
A. Record available Answer
B. Not available
C. inconsistent table emp
D. Space is allocated to emp table during.

103. When the space is allocated for the temporary table,


A. select
B. During first DML Answer
C. compilation
D. data dictionary update
104. Select 1,2 from dual
Union all
Select ‘A’,’B’ from dual
a. Error at line 1 Answer
b. Error at line 2
c. Error at line 3
d. None

SQL> select 1,2 from dual


2 union
3 select 'A','B' from dual;
select 1,2 from dual
*
ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression

105. By default what is the order in order by


a. Desc
b. Asc Answer

106. Select a,b from table order by a desc


Select a,b from table order by 2 desc
a. Both gives the same result
b. Both are not same Answer

107. Which of the following is Data query language?


Answer Select

108. Char manipulation function


a. Trim Answer
b. Trunc
c. To_Date
d. CASE

109. Select id from emp1,emp2 where emp1.id = emp2.id? Which error the statement will
get? (Something like this, not exactly same)
Ans:- Column in select statement is not preceded by table name and the id is available in both
the tables.
110. If the table has some data and you are trying to enforce the constraint which does not
satisfy the available data. Will it accept the constraint?
a. Yes
b. No Answer
SQL> alter table etemp add check (id > 10);
alter table etemp add check (id > 10)
*
ERROR at line 1:
ORA-02293: cannot validate (SCOTT.SYS_C003541) - check constraint violated

111. Even records required to display.what is the query?


A. select * from emp e1 where (rowid,1) (select rowid,MOD(rownum,2) from emp e2)
B. select * from emp e1 where (rowid,0) (select rowid,MOD(rownum,2) from emp e2)
C.
D.
113.order by
A. Put in the last line of query
B.can use alias columname
C.
D.
114. Subquery is true for
A.retrieve data from more than one table
B.retrieve data from only one table.
C.Not use LIKE operator
D.
115.subquery used for..?
116.Left outer join def. True or False
Def: Retriving data from inner join and one row matching with eachrow which not matching from
second table.
117. Constraint enforce integrity supporting related question.
Note: please read related above topics
118. Drop column syntax?
119. On only one table having foreign key constraint. We can call as
A. Self foreign key constraint
B.Self referential integrity
C.self reference key
D.
120.Not valid data type in oracle
A.DATE
B.TIMESTAMP(3)
C.TIMESTAMP(6)
D.TIME

You might also like