0

databases Online Quiz - 229

Description: databases Online Quiz - 229
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

What conditions have to be met before dropping a tablespace?

  1. The tablespace must be offline

  2. The tablespace must be online

  3. The tablespace cannot have active segments

  4. The administrator NOT needs the correct system privilege


Correct Option: C

Which of the following events can be used to fire triggers?

  1. sysdate

  2. Truncate

  3. avg

  4. To_date


Correct Option: B

Which names are NOT appropriate database object names?

  1. "SELECT"

  2. "_Marketing"

  3. m364DaYs

  4. SELECT


Correct Option: D

Which of the following queries can you use to search for employees with the pattern 'A_B' in their names?

  1. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%' ESCAPE '\';

  2. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%' ESCAPE;

  3. SELECT last_name FROM employees WHERE last_name LIKE 'A_B%' ESCAPE '%';

  4. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%' ESCAPE '\';


Correct Option: D

To write a query that performs an outer join of tables A and B and returns all rows from B, You need to write

  1. any outer join

  2. a left outer join

  3. a cross join

  4. a right outer join


Correct Option: D

AI Explanation

To answer this question, you need to understand the concept of outer joins.

An outer join is used to combine records from two tables, even if there is no match between the columns being joined. There are three types of outer joins: left outer join, right outer join, and full outer join.

In this case, the question asks for a query that returns all rows from table B. To achieve this, you need to perform a right outer join.

Option A) Any outer join - This option is incorrect because it is too general and does not specify the type of outer join required.

Option B) Left outer join - This option is incorrect because a left outer join would return all rows from table A, not table B.

Option C) Cross join - This option is incorrect because a cross join returns the Cartesian product of the two tables, which is not what the question asks for.

Option D) Right outer join - This option is correct because a right outer join combines all rows from table B, even if there is no match in table A.

Therefore, the correct answer is D) a right outer join.

15 Examine the description of the STUDENTS table: STD_ID NUMBER (4) COURSE_ID VARCHAR2 (10) START_DATE DATE END_DATE DATE Which two aggregate functions are valid on the START_DATE column? (Choose two)

  1. SUM(start_date)

  2. AVG(start_date)

  3. COUNT(start_date)

  4. MIN(start_date)


Correct Option: C,D

You would like to display the system date in the format "Monday, 01 June, 2001". Which SELECT statement should you use?

  1. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;

  2. SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;

  3. SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;

  4. SELECT TO_CHAR (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;


Correct Option: C

Which two statements complete a transaction? (Choose two.)

  1. DELETE employees;

  2. DESCRIBE employees;

  3. ROLLBACK TO SAVEPOINT C;

  4. ALTER TABLE employees SET UNUSED COLUMN sal;

  5. GRANT SELECT ON employees TO SCOTT;


Correct Option: C,D

AI Explanation

To complete a transaction, there are typically two statements involved: COMMIT and ROLLBACK.

Let's go through each option to determine which two statements complete a transaction:

A. DELETE employees; This statement is used to delete data from a table but does not complete a transaction.

B. DESCRIBE employees; This statement is used to describe the structure of a table but does not complete a transaction.

C. ROLLBACK TO SAVEPOINT C; This statement is used to rollback a transaction to a specific savepoint, effectively undoing all changes made after that savepoint. This is one of the statements that completes a transaction.

D. ALTER TABLE employees SET UNUSED COLUMN sal; This statement is used to mark a column as unused in a table, but it does not complete a transaction.

E. GRANT SELECT ON employees TO SCOTT; This statement is used to grant select privileges on a table to a user, but it does not complete a transaction.

Based on the above analysis, the two statements that complete a transaction are:

C. ROLLBACK TO SAVEPOINT C; D. ALTER TABLE employees SET UNUSED COLUMN sal;

Therefore, the correct answer is C and D.

Which object privileges can be granted on a view?

  1. none

  2. DELETE, INSERT, SELECT

  3. ALTER, DELETE, INSERT, SELECT

  4. DELETE, INSERT, SELECT, UPDATE


Correct Option: D

AI Explanation

To answer this question, we need to understand the concept of object privileges and views.

Object privileges are permissions that can be granted to users on database objects such as tables, views, or procedures. These privileges determine the actions that a user can perform on the object, such as SELECT, INSERT, UPDATE, or DELETE.

A view is a virtual table created from the result of a query. It does not contain any data itself but presents data from one or more underlying tables. Users can interact with views as if they were regular tables, but the underlying data is not directly modified.

In the given options, the correct answer is D. DELETE, INSERT, SELECT, UPDATE. This means that users can be granted the privilege to perform DELETE, INSERT, SELECT, and UPDATE operations on the view. With these privileges, users can modify and retrieve data from the view, just as they would with a regular table.

Let's go through each option to understand why it is correct or incorrect:

Option A) none - This option is incorrect because users can be granted object privileges on views. Option B) DELETE, INSERT, SELECT - This option is incorrect because it does not include the UPDATE privilege, which allows users to modify data in the view. Option C) ALTER, DELETE, INSERT, SELECT - This option is incorrect because it includes the ALTER privilege, which is not applicable to views. The ALTER privilege is used for modifying the structure or properties of database objects, such as tables or procedures. Option D) DELETE, INSERT, SELECT, UPDATE - This option is correct because it includes all the necessary privileges (DELETE, INSERT, SELECT, and UPDATE) that can be granted on a view.

Therefore, the correct answer is D. DELETE, INSERT, SELECT, UPDATE. This option is correct because it includes all the privileges that can be granted on a view.

Which command will delete all data from a table and will not write to the rollback segment?

  1. DROP

  2. DELETE

  3. CASCADE

  4. TRUNCATE


Correct Option: D

Which Oracle access method is the fastest way for Oracle to retrieve a single row?

  1. Primary key access

  2. Access via unique index

  3. Table access by ROWID

  4. Full table scan


Correct Option: C

Which character function can be used to return a specified portion of a character string?

  1. INSTR

  2. SUBSTR

  3. SUBSTRING

  4. POS


Correct Option: B

When a user creates an object without a TABLESPACE clause, where will Oracle store the segment?

  1. System tablespace

  2. Users tablespace

  3. Default tablespace for the user

  4. Oracle will give an error

  5. Undefined


Correct Option: C

Which character is used to continue a statement in SQL*Plus?

  1. *

  2. #

  3. /

  4. -

  5. @


Correct Option: D

AI Explanation

To answer this question, you need to understand how SQL*Plus works and how statements are executed.

SQL*Plus is a command-line interface provided by Oracle for executing SQL and PL/SQL statements. In SQL*Plus, a statement can be continued onto the next line using the character "-".

Option A) * - This option is incorrect because the "*" character is not used to continue a statement in SQL*Plus. Option B) # - This option is incorrect because the "#" character is not used to continue a statement in SQL*Plus. Option C) / - This option is incorrect because the "/" character is used to execute a statement in SQL*Plus, not to continue a statement. Option D) - - This option is correct because the "-" character is used to continue a statement onto the next line in SQL*Plus. Option E) @ - This option is incorrect because the "@" character is used in SQL*Plus to execute a script or a file, not to continue a statement.

The correct answer is Option D) "-". This option is correct because the "-" character is used to continue a statement in SQL*Plus.

Assuming today is Friday, 28 August 2009, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'FRIDAY'), 'DD-MON-RR') FROM dual;

  1. 21-AUG-09

  2. 28-AUG-09

  3. 04-SEP-09

  4. 29-AUG-09

  5. 27-AUG-09


Correct Option: C

To produce a meaningful result set without any cartesian products, what is the minimum number of conditions that should appear in the WHERE clause of a four-table join?

  1. 8

  2. 3

  3. 5

  4. There is no such criteria


Correct Option: B

Which of the following can be a valid column name?

  1. Column

  2. 1966_Invoices

  3. Catch_#22

  4. #Invoices

  5. None of the above


Correct Option: C

Normalization is…

  1. the process of arranging information stored in a database in a way, which removes redundancy and ambiguity.

  2. a special way of selecting data

  3. the process of adding primary key to a table

  4. All the above


Correct Option: D

A trigger is…

  1. a special type of store procedure, executed when certain event occurs

  2. a special type of table

  3. a special type of view

  4. All the above


Correct Option: D

Which SQL statement selects all rows from table called Contest, with column ContestDate having values greater or equal to May 25, 20006?

  1. SELECT * FROM Contest WHERE ContestDate < '05/25/2006'

  2. SELECT * FROM Contest HAVING ContestDate >= '05/25/2006'

  3. SELECT * FROM Contest WHERE ContestDate >= '05/25/2006'

  4. none of the above


Correct Option: D
- Hide questions