PL-SQL and SQL Database Concepts
Quiz covering PL/SQL control structures, block syntax, and SQL functions, queries, and data manipulation commands
Questions
What is true about MERGE command? Choose all that apply.
- It is a DML command
- It is a DDL command
- Provides the ability to conditionally update or insert data into a database table
- Provides the ability to MERGE VIEWS and INDICES of a TABLE
Select TYPES of JOINS. Choose all that apply.
- EQUI-JOIN
- NONEQUI-JOIN
- SELF-JOIN
- OUTER-JOIN
- MERGE-JOIN
- TRANSACTION-JOIN
Choose the MANDATORY clauses of SELECT SQL statement
- SELECT
- WHERE
- GROUP BY
- FROM
- ORDER BY
- HAVING
ALIAS can be used for TABLE as well as COLUMN to simplify interpretation of SQL query
- True
- False
Identify the correct outputselect INITCAP('ORACLE BASICS') from dual;
- ORACLE BASICS
- Oracle Basics
- oracle basics
- oracleBasics
Identify the correct output ---select CONCAT('ORACLE' || 'BASICS') from dual;
- ORACLE BASICS
- ORACLEBASICS
- oraclebasics
- oracleBasics
Identify the correct output --- select SUBSTR('ORACLE BASICS',-6,5) from dual;
- BASIC
- BASICS
- E BAS
- ORACL
Identify the correct output --- select TRUNC(TO_DATE('01-SEP-1995', 'DD-MON-YYYY'),'YEAR') from dual;
- 01-SEP-1995
- 01-JAN-1995
- 01-JAN-1996
- 1995
- 1996
Identify the correct output --- select ADD_MONTHS(TO_DATE('01-SEP-1995', 'DD-MON-YYYY'), 6) from dual;
- 01-MAR-1996
- 01-FEB-1996
- 07-SEP-1995
- 06-SEP-1995
Identify the correct output --- select LAST_DAY(TO_DATE('01-SEP-1995', 'DD-MON-YYYY')) from dual;
- 31-AUG-1995
- 30-SEP-1995
- 31-OCT-1995
- 31-DEC-1995
Which functions mentioned below are GROUP functions? Choose all that apply
- ADD_MONTHS
- COUNT
- ROUND
- DISTINCT
- AVG
- SUM
WHERE clause is used to restrict groups
- True
- False
One can NOT delete a row from the VIEW if view definition contains ... Choose all that apply
- WHERE clause
- GROUP BY clause
- GROUP functions
- DISTINCT keyword
- FROM clause
An application developer wants to query row count of a table, ORDERS which has millions of records. ORDERS table has composite PRIMARY KEY on (ORDER_ID, CUSTOMER_ID) columns and those two columns appear at position 1 and 2 respectively in the ORDERS table. Which query will be more efficient?
- select count(*) from orders;
- select count(1) from orders;
- select count(3) from orders;
- select count(5) from orders;
Identify the MANDATORY sections of a PL/SQL block
- DECLARE
- BEGIN
- EXCEPTION
- END
%ROWTYPE attribute is used to declare a variable and associate it's data type with the TABLE/CURSOR object.
- True
- False
Within a PL/SQL block, which commands are allowed? Choose all that apply
- SELECT
- CREATE
- DELETE
- DROP
- UPDATE
- INSERT
INSERT, UPDATE, DELETE commands when used in a PL/SQL block, should contain INTO clause to hold the data returned by SQL statement
- True
- False
IF-THEN-ELSE-ENDIF construct is used for conditional control in a PL/SQL block. What happens if the condition in IF-THEN-ELSE-ENDIF block evaluates to NULL?
- The SQL statements in the IF condition are processed.
- The SQL statements in the ELSE condition are processed.
- IF-THEN-ELSE-ENDIF construct is skipped.
- The SQL statements in the IF condition as well as ELSE condition are processed.
Identify the ITERATIVE control constructs in PL/SQL. Choose all that apply
- Cursors
- Cursor For Loop
- Simple Loop
- Exit Loop
- Numeric For Loop
- While Loop