SQL and Database Fundamentals

Quiz covering SQL operations, PL/SQL programming, constraints, joins, transactions, and database concepts across Oracle and DB2 systems.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

A subquery can be used to _________.

  1. Create groups of data
  2. Sort data in a specific order
  3. Convert data to a different format
  4. Retrieve data based on an unknown condition
Question 2 Multiple Choice (Single Answer)

what does the sql code -922 represents?

  1. query will retrieve only one row
  2. authorization failure
  3. no such code available
  4. rollback
Question 3 Multiple Choice (Multiple Answers)

choose the environments which can access DB2

  1. TSO
  2. IMC
  3. CICS
  4. None of the above
Question 4 Multiple Choice (Single Answer)

5 rows are inserted to a DB2 Table. Next 3 of those are updated, then a rollback is issued. What would happen when the rollback is issued?

  1. returns 5 rows
  2. returns 3 rows
  3. returns all 8rows
  4. none
Question 5 Multiple Choice (Multiple Answers)

Which are true regarding the use of outer joins?

  1. You cannot use IN operator in a condition that involves an outerjoin
  2. You use (+) on both sides of the WHERE condition to perform an outerjoin
  3. You use (*) on both sides of the WHERE condition to perform an outerjoin
  4. You use an outerjoin to see only the rows that do not meet the join condition
  5. In the WHERE condition, you use (+) following the name of the column in the table
  6. You cannot link a condition that is involved in an outerjoin to another condition by
Question 6 Multiple Choice (Multiple Answers)

Which two statements complete a transaction? (Choose two)

  1. DELETE employees;
  2. DESCRIBE employees;
  3. ROLLBACK TO SAVEPOINT C;
  4. GRANT SELECT ON employees TO SCOTT;
  5. ALTER TABLE employees SET UNUSED COLUMN sal;
  6. Select MAX(sal) FROM employees WHERE department_id = 20;
Question 7 Multiple Choice (Multiple Answers)

Which two are true about aggregate functions? (Choose two.)

  1. You can use aggregate functions in any clause of a SELECT statement.
  2. You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement.
  3. You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.
  4. You can pass column names, expressions, constants, or functions as parameters to an aggregate function.
  5. You can use aggregate functions on a table, only by grouping the whole table as one single group.
  6. You cannot group the rows of a table by more than one column while using aggregate functions.
Question 8 Multiple Choice (Single Answer)

Which of the following is not a valid aggregate function

  1. COUNT
  2. SUM
  3. COMPUTE
  4. MIN
Question 9 Multiple Choice (Single Answer)

To use a FETCH staement with a cursor you always have to supply an explicit direction such next or prior.

  1. TRUE
  2. FALSE
  3. BOTH
  4. NONE
Question 10 Multiple Choice (Single Answer)

Which of the following is non-PL/SQL variable?

  1. Scalar
  2. LOB
  3. Reference
  4. host
Question 11 True/False

PL/SQL does not support boolean variables

  1. True
  2. False
Question 12 Multiple Choice (Multiple Answers)

Which four are valid Oracle constraint types?

  1. CASCADE
  2. UNIQUE
  3. NONUNIQUE
  4. CHECK
  5. PRIMARY KEY
  6. NOT NULL
Question 13 Multiple Choice (Single Answer)

Which is an iSQL*PLUS command?

  1. INSERT
  2. UPDATE
  3. SELECT
  4. DESCRIBE
  5. DELETE
  6. RENAME
Question 14 Multiple Choice (Multiple Answers)

Top N analysis requires _____ and ______?(Choose two)

  1. the use of rowed
  2. a GROUP BY clause
  3. an ORDER BY clause
  4. only an inline view
  5. an inline view and an outer query
Question 15 Multiple Choice (Single Answer)

Which constraint can be defined only at the column level?

  1. UNIQUE
  2. NOT NULL
  3. CHECK
  4. PRIMARY KEY
  5. FOREIGN KEY
Question 16 Multiple Choice (Single Answer)

What does the FORCE option for creating a view do?

  1. creates a view with constraints
  2. creates a view even if the underlying parent table has constraints
  3. creates a view in another schema even if you don't have privileges
  4. creates a view regardless of whether or not the base tables exist
Question 17 Multiple Choice (Single Answer)

The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement accomplishes this?

  1. GRANT select ON dept TO ALL USERS;
  2. GRANT select ON dept TO ALL;
  3. GRANT QUERY ON dept TO ALL USERS;
  4. GRANT select ON dept TO PUBLIC;
Question 18 Multiple Choice (Multiple Answers)

Which three are true?(Choose three)

  1. A MERGE statement is used to merge the data of one table with data from another
  2. A MERGE statement replaces the data of one table with that of another
  3. A MERGE statement can be used to insert new rows into a table
  4. A MERGE statement can be used to update existing rows in a table
Question 19 Multiple Choice (Single Answer)

What is true about Sequences?

  1. Once created, a sequence belongs to a specific schema
  2. Once created, a sequence is linked to a specific table
  3. Once created, a sequence is automatically available to all users
  4. Only the DBA can control which squence is used by certain a table
  5. Once created, a sequence is automatically in all INSERT and UPDATE statements
Question 20 Multiple Choice (Single Answer)

John has created a procedure named SALARY_CALC. Which SQL query allows him to view the text of the procedure?

  1. SELECT text FROM user_source WHERE name ='SALARY_CALC';
  2. SELECT * FROM user_source WHERE source_name ='salary_calc';
  3. SELECT * FROM user_objects WHERE object_name = 'SALARY_CALC';
  4. SELECT text FROM user_source WHERE name='SALARY_CALC' AND owner ='JOHN';