Oracle SQL Functions and Queries
Tests knowledge of Oracle SQL string functions (TRANSLATE, REPLACE, INSTR), numeric operations, set operations (UNION ALL, MINUS), and error handling with DUAL table queries.
Questions
How many rows records the following query will display.. select * from TEMP where rownum in (1,3,3,2) N.R. Temp table has 30 records
- NULL
- 1 row
- 3 rows
- 4 rows
- 0 row
select '1'+'1' from dual ; The o/p would be..
- 2
- 1+1
- Error: invalid number
- Error: invalid Character
- Error: invalid identifier
The o/p of the below two queries would be same.. 1.select '1'+1 from dual; 2.select 1+1 from dual;
- True
- False
O/p of the below query ?? select 'a''a' from dual;
- aa
- a a
- a'a
- Error: invalid identifier
- Error: invalid character
select "aa" from dual ?
- Error: "aa":invalid identifier
- aa
- "aa"
- Error: invalid character
select dummy from dual ?
- NULL
- Error: invalid identifier
- X
- Error: invalid SQL Statemet
- A
select * from dual ?
- A
- X
- NULL
- Error: Invalid SQL statement
- Error: Invalid Identifier
select dummy from dual minus select * from dual what would be output ?
- No rows returned
- Error: invalid SQL statement
- Error: invalid identifier
- Error: syntax error
- 1 row
select version from dual ;
- Error: "VERSION": invalid identifier
- Error: "VERSION": invalid character
- Error: invalid SQL statement
- shows oracle database version
- Null
select expr(1/0) from dual; The o/p would be ..
- 0
- Error: divisor is equal to zero
- Error: Invalid Identifier
- NULL
Output of the below two queries will be same.. 1.select nvl('abc','a') from dual; 2.select nvl('abc',0) from dual;
- True
- False
The o/p of the below query would be.. select nvl('abc','a') from dual union all select nvl('abc',0) from dual minus select replace('abc','a','a') from dual
- No rows returned
- abc
- Two rows of value 'abc'
- Error: Syntax error
select instr('Hi Partha Sarathi Ojha','a',6,-1) from dual; The output would be..
- Error: Syntax error
- 0
- 5
- Error: Argument '-1' is out of range
select instr('Hi Partha Sarathi Ojha','a',5) from dual; The o/p would be...
- 5
- 9
- 22
- 0
Want to search character 'a' from last in the string 'Hi Partha Sarathi Ojha'. So what would be the query...
- select instr('Hi Partha Sarathi Ojha',last,'a') from dual
- select instr('Hi Partha Sarathi Ojha','a',-1) from dual
- select instr('Hi Partha Sarathi Ojha',left,'a') from dual
- select instr('Hi Partha Sarathi Ojha',-1,'a') from dual
- select instr('Hi Partha Sarathi Ojha','-a') from dual
select translate('abcda','ab','ef') from dual; The o/p would be...
- efcda
- efcde
- ef
- ab
- 1
select replace('abcda','ab','ef') from dual ; The o/p would be..
- efcda
- efcde
- ef
- ab
- 1
The o/p of the below two queries will be same ? 1.select translate('abcd','a','d') from dual; 2.select replace('abcd','a','d') from dual;
- True
- False
The o/p of the below query.. select 1/0 from dual ;
- Error: Syntax error
- INFINITY
- NULL
- 0
- Error: divisor is equal to zero
The o/p of the below query.. select 0/1 from dual group by dummy;
- 0
- 1
- NULL
- Error: divisor is equal to zero
- Error: Not a GROUP BY clause