Sie sind auf Seite 1von 4

1)What is NVL?

NVL: Null value function converts a null value to a non-null value for the purpo
se of evaluating an expression. Numeric Functions accept numeric I/P & return nu
meric values. They are MOD, SQRT, ROUND, TRUNC & POWER.
2)How can variables be passed to a SQL routine?
By use of the & symbol. For passing in variables the numbers 1-8 can be used (&1
, &2,...,&8) to pass the values after the command into the SQLPLUS session. To b
e prompted for a specific variable, place the ampersanded variable in the code i
tself: select * from dba_tables where owner=&owner_name; . Use of double ampersand
s tells SQLPLUS to resubstitute the value for each subsequent use of the variabl
e, a single ampersand will cause a reprompt for the value unless an ACCEPT state
ment is used to get the value from the user.
3)Which function is used to find the largest integer less than or equal to a spe
cific value?
A) CEIL
B) FLOOR
c) ROUND
D)TRUNCATE
Ans: B
4)List the emps in the asc order of Designations of those joined after the secon
d half of 1981.
Ans: select * from emp where hiredate > (30-jun-81) and to_char(hiredate,YYYY) = 198
1 order by job asc;
5)List the emps who are senior to King.
A) select * from emp where hiredate < ( select hiredate from emp where ename = KI
NG);
6) List the Emps of Deptno 20 whose Jobs are same as Deptno10.
A) select * from emp e ,dept d where d.deptno = 20 and e.deptno = d.deptno and e
.job in ( select e.job from emp e,dept d where e.deptno = d.deptno and d.deptno
=10);
7) List the emps whose sal is equal to the average of max and minimum
A) select * from emp where sal =(select (max(sal)+min(sal))/2 from emp);
8) Find out the most recently hired emps in each Dept order by Hiredate.
A) select * from emp e where hiredate in
(select max(hiredate) from emp where e.deptno = deptno )
order by hiredate;
9)Which of the following has been achieved by the following SQL codes? SELECT em
ployee_id FROM employees WHERE commission_pct = .5 OR salary > 23000;
it returns employees who have a 50% of a salary greater than $23,000:
it returns employees who have a 50% commission rate or a salary greater than $23
,000:
runtime error
it returns employees who have a 50% of a salary less than $23,000:
invalid syntax F. it returns employees who have a 50% commission rate and a sala
ry greater than $23,000:
Answer: B
10) what is the difference between NOT IN and NOT EXISTS?
Ans: EXISTS is more faster than IN because EXISTS returns a Boolean value wherea
s IN returns a value.
11. What command is used to create a table by copying the structure of another t
able?
Answer : Create table <table-name1> as select * from <table-name2> where 1=2;
12) Why does the following command give a compilation error?
DROP TABLE &TABLE_NAME;
Variable names should start with an alphabet. Here the table name starts with an
'&' symbol.
13) What are the various types of queries ?
Answer: The types of queries are:
Normal Queries
Sub Queries
Co-related queries
Nested queries
Compound queries
14) What is the maximum no.of columns a table can have ?
Answer: 254.
15) What is the significance of the & and && operators in PL SQL ?
Answer: The & operator means that the PL SQL block requires user input for a var
iable.
The && operator means that the value of this variable should be the same as inpu
tted by the user previously for this same variable
16) Can you use %RowCount as a parameter to a cursor ?
Answer: Yes
17) How many rows will the following SQL return :
Select * from emp Where rownum = 10;
Answer: No rows
18) Can you alter synonym of view or view ?
Answer: No
19) Can you create index on view
Answer: No.
20) Which SQL statement returns a numeric value?
A. SELECT ADD_MONTHS(MAX (hire_date), 6) FROM EMP;
B. SELECT ROUND(hire_date)FROM EMP;
C. SELECT sysdate-hire_date FROM EMP;
D. SELECT TO_NUMBER(hire_date + 7)FROM EMP;
Ans: C
21) Which two statements about sequences are true?(choose any 2)
A. You use a NEXTVAL pseudo column to look at the next possible value that would
be generated from a sequence, without actually retrieving the value.
B. You use a CURRVAL pseudo column to look at the current value just generated f
rom a sequence, without affecting the further values to be generated from the se
quence.
C. You use a NEXTVAL pseudo column to obtain the next possible value from a sequ
ence by actually retrieving the value form the sequence
D. You use a CURRVAL pseudo column to generate a value from a sequence that woul
d be used for a specified database column.
Ans:B,C
22) Which operator can be used with a multiple row subquery?
A. =
B. LIKE
C. BETWEEN
D. NOT IN
E. Is
F. <>
Ans:D
23) Which two statements about subqueries are true? (Choose two.)
A. A subquery should retrieve only one row.
B. A subquery can retrieve zero or more rows.
C. A subquery can be used only in SQL query statements.
D. Subqueries CANNOT be nested by more than two levels.
E. A subquery CANNOT be used in an SQL query statement that uses group functions
.
F. When a subquery is used with an inequality comparison operator in the outer S
QL statement, the column list in the SELECT clause of the subquery should contai
n only one column
Ans:B,F
24) Which two statements about views are true? (Choose two)
A. A view can be created as read only
B. A view can be created as a join on two or more tables.
C. A view cannot have an ORDER BY clause in the SELECT statement.
D. A view cannot be created with a GROUP BY clause in the SELECT statement.
E. A view must have aliases defined for the column names in the SELECT statement
.
Ans:A,B
25) what is the difference between rowid and rownum
26)SUBSTR(SQUARE ANS ALWAYS WORK HARD,14,6) will return
a] ALWAY
b} S ALWA
c] ALWAYS
Ans : C
27) TRANSLATE('333SQD234','0123456789ABCDPQRST','0123456789') will return
a] 333234
b] 333333
c] 234333
d] None of the above
Ans : A

Das könnte Ihnen auch gefallen