Oracle Sql Basics(Engineering > Computer Science And Engineering > Oracle Database ) Questions and Answers

Question 1. In an SQL statement, which of the following parts states the conditions for row selection?
  1.    Where
  2.    From
  3.    Order By
  4.    Group By
Explanation:-
Answer: Option A. -> Where


In an SQL statement where clause states the conditions for row selection.



Question 2. Which of the following keyword is used with Data Control Language (DCL) statements?
  1.    SELECT
  2.    INSERT
  3.    DELETE
  4.    GRANT
Explanation:-
Answer: Option D. -> GRANT


GRANT is the keyword which is used with Data Control Language statements.



Question 3. A type of query that is placed within a WHERE or HAVING clause of another query is called
  1.    Master query
  2.    Sub query
  3.    Super query
  4.    Multi-query
Explanation:-
Answer: Option B. -> Sub query


Sub-query that is placed within a WHERE or HAVING clause of another query.



Question 4. In SQL, which of the following is not a data definition language commands?
  1.    RENAME
  2.    REVOKE
  3.    GRANT
  4.    UPDATE
Explanation:-
Answer: Option A. -> RENAME


With RENAME statement you can rename a table.RENAME, REVOKE and GRANT are DDL commands and UPDATE is DML command.



Question 5. SQL has how many main commands for DDL:
  1.    1
  2.    2
  3.    3
  4.    4
Explanation:-
Answer: Option C. -> 3


Create, Delete, Alter these are 3 main command.



Question 6. Stack is also called __________
  1.    First In First Out (FIFO)
  2.    Last In First Out (LIFO)
  3.    First In Last Out (FILO)
  4.    First Come First Served (FCFS)
Explanation:-
Answer: Option C. -> First In Last Out (FILO)


Stack works on the First In Last Out.



Question 7. The SQL statement SELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) FROM DUAL;
  1.    6789
  2.    2345
  3.    1234
  4.    456789
Explanation:-
Answer: Option B. -> 2345


INSTR function in SQL is used to find the starting location of a pattern in a string. The syntax for the INSTR function is as
follows:INSTR(str,pattern):Find the starting location of pattern in string str and SUBSTR Function:- The Substring function in SQL is used to grab a portion of the stored data.



Question 8. A command that lets you change one or more fields in a record is
  1.    Insert
  2.    Modify
  3.    Look-up
  4.    All of the Mentioned
Explanation:-
Answer: Option B. -> Modify


Sometimes we need to change the data type of a column. To do this, we use the ALTER TABLE Modify Column ALTER TABLE table_name, MODIFY column_name "New Data Type.



Question 9. Which of the following is illegal?
  1.    SELECT SYSDATE "“ SYSDATE FROM DUAL;
  2.    SELECT SYSDATE "“ (SYSDATE "“ 2) FROM DUAL;
  3.    SELECT SYSDATE "“ (SYSDATE + 2) FROM DUAL;
  4.    None of the Mentioned
Explanation:-
Answer: Option D. -> None of the Mentioned


SELECT SYSDATE “ SYSDATE FROM DUAL; outputs 0 SELECT SYSDATE “ (SYSDATE “ 2) FROM DUAL; outputs 2
SELECT SYSDATE “ (SYSDATE + 2) FROM DUAL; outputs -2.



Question 10. ________clause is an additional filter that is applied to the result.
  1.    Select
  2.    Group-by
  3.    Having
  4.    Order by
Explanation:-
Answer: Option C. -> Having


The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.