0

databases Online Quiz - 81

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

Which statment about trigger is TRUE ?

  1. we can use Application Trigger to fire when a DELETE statement occurs

  2. we can use database Trigger to fire when a INSERT statement occurs

  3. we can use System event Trigger to fire when a DELETE statement occurs

  4. we can use INSTEAD OF trigger to fire when a INSERT statement occurs


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) We can use Application Trigger to fire when a DELETE statement occurs - This option is incorrect. Application triggers are specific to certain applications and are not directly related to database operations such as DELETE statements.

Option B) We can use database Trigger to fire when an INSERT statement occurs - This option is correct. Database triggers can be defined to fire before or after various database operations, including INSERT statements.

Option C) We can use System event Trigger to fire when a DELETE statement occurs - This option is incorrect. System event triggers are used to respond to system-level events, such as system startup or shutdown, rather than specific database operations like DELETE statements.

Option D) We can use INSTEAD OF trigger to fire when an INSERT statement occurs - This option is incorrect. INSTEAD OF triggers are typically used with views and allow the trigger to take the place of the actual DML operation (e.g., INSERT, UPDATE, DELETE). However, they are not specific to INSERT statements only.

The correct answer is option B. We can use a database trigger to fire when an INSERT statement occurs. Database triggers are commonly used to define actions that are automatically executed in response to specific database events.

Which is valid in creating DML triggers ?

  1. DURING

  2. INSTEAD

  3. ON SHUTDOWN

  4. BEFORE


Correct Option: D

CALL statement inside the trigger body enable to call ?

  1. Package

  2. Stored function

  3. Stored procedure

  4. Another DB trigger


Correct Option: C

AI Explanation

To answer this question, you need to understand triggers and their capabilities.

Triggers are database objects that are automatically executed in response to specific events, such as changes to data in a table. They can be used to enforce business rules, perform auditing, or automatically update related data.

When a trigger is fired, it can execute SQL statements or call other database objects. In this case, the CALL statement is used to call a stored procedure. Therefore, the correct answer is C) Stored procedure.

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

Option A) Package - A CALL statement inside a trigger body cannot directly call a package. However, a stored procedure or function within the package can be called using the CALL statement.

Option B) Stored function - A CALL statement inside a trigger body can call a stored function. This is a valid option, but it is not the correct answer given in the question.

Option C) Stored procedure - A CALL statement inside a trigger body can call a stored procedure. This is the correct answer, as stated in the question.

Option D) Another DB trigger - A CALL statement inside a trigger body can call another trigger. However, it is generally not recommended to have triggers calling other triggers directly, as it can lead to complex and difficult-to-maintain code.

Therefore, the correct answer is C) Stored procedure. This option is correct because a CALL statement inside a trigger body enables the calling of a stored procedure.

  1. DELETE TRIGGER business_hour

  2. DROP TRIGGER business_hour

  3. REMOVE TRIGGER business_hour

  4. ALTER TRIGGER business_hour remove


Correct Option: B

The OLD and NEW Qualifier is used in which type of trigger?

  1. Row level DML trigger

  2. Statement level DML trigger

  3. System trigger

  4. Application Trigger


Correct Option: A
  1. ALTER TRIGGERS ON TABLE EMP DISABLE

  2. ALTER EMP DISABLE ALL TRIGGERS

  3. NOT POSSIBLE TO DISABLE TRIGGERS

  4. ALTER TABLE EMP DISABLE ALL TRIGGERS


Correct Option: D

How many columns are presented after executing this query: SELECT address1||','||address2||','||address2 "Adress" FROM employee;

  1. 1

  2. 2

  3. 3

  4. 4


Correct Option: C

AI Explanation

To answer this question, we need to understand the concept of concatenation in SQL and the number of aliases used in the query.

The given query is:

SELECT address1||','||address2||','||address2 "Address" FROM employee;

In this query, we are concatenating three columns: address1, ',', and address2. We are using the pipe symbol (||) to concatenate these values.

We are also giving an alias "Address" to the concatenated result.

Now let's go through each option to determine the correct answer:

Option A) 1 - This option is incorrect because we are concatenating three columns, so there should be three columns in the result.

Option B) 2 - This option is incorrect because we are concatenating three columns, so there should be three columns in the result.

Option C) 3 - This option is correct because we are concatenating three columns, so there should be three columns in the result.

Option D) 4 - This option is incorrect because we are concatenating three columns, so there should be three columns in the result.

Therefore, the correct answer is C) 3. This option is correct because the query concatenates three columns, resulting in three columns in the output.

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

  1. Full table scan

  2. Table access by ROWID

  3. Access via unique index

  4. Primary key access


Correct Option: B

Which of the following can be a valid column name?

  1. Column

  2. 1966_Invoices

  3. Catch_#22

  4. #Invoices


Correct Option: C

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

  1. drop

  2. truncate

  3. delete

  4. cascade


Correct Option: B

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

The primary key on table EMP is the EMPNO column. Which of the following statements will not use the associated index on EMPNO?

  1. select * from EMP where nvl(EMPNO, '00000') = '59384';

  2. select 1 from EMP where EMPNO = '59834';

  3. select EMPNO, LASTNAME from EMP where EMPNO = '59384'

  4. select * from EMP where EMPNO = '59384';


Correct Option: A
Explanation:

To answer this question, the user needs to understand what a primary key and an index are, and how they are related.

A primary key is a column or set of columns that uniquely identifies each row in a table. An index is a data structure that stores a copy of selected columns of a table to improve the speed of data retrieval operations on that table.

Now, let's go through each option and determine whether or not it will use the associated index on EMPNO:

A. select * from EMP where nvl(EMPNO, '00000') = '59384'; This statement will not use the associated index on EMPNO because the NVL function applied to EMPNO will turn an indexed column into an unindexed one. Using functions on indexed columns can result in the optimizer not choosing to use the index.

B. select 1 from EMP where EMPNO = '59834'; This statement will use the associated index on EMPNO because it is directly comparing the EMPNO to a value, and that is what the index is built on.

C. select EMPNO, LASTNAME from EMP where EMPNO = '59384' This statement will use the associated index on EMPNO because it is directly comparing the EMPNO to a value, and that is what the index is built on.

D. select * from EMP where EMPNO = '59384'; This statement will use the associated index on EMPNO because it is directly comparing the EMPNO to a value, and that is what the index is built on.

Therefore, the statement that will not use the associated index on EMPNO is option A.

The Answer is: A

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


Correct Option: C

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

  1. *

  2. -

  3. /

  4. @


Correct Option: B

AI Explanation

To answer this question, you need to understand the SQL*Plus tool used for executing SQL commands in Oracle.

In SQL*Plus, the character used to continue a statement onto the next line is the hyphen (-).

The correct answer is B) - (hyphen). This option is correct because the hyphen character is used in SQL*Plus to continue a statement onto the next line.

Assuming today is Monday, 10 July 2000, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual;

  1. 03-JUL-00

  2. 10-JUL-00

  3. 11-JUL-00

  4. 17-JUL-00


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. 2

  3. 3

  4. 4


Correct Option: C

Which of the following is the lowest cost DB2 product that can be legally installed on a Windows server that has 2 CPUs?

  1. DB2 Everyplace

  2. DB2 Express Edition

  3. DB2 Workgroup Server Edition

  4. DB2Enterprise Server Edition


Correct Option: B

Which of the following products is allowed to access other DB2 servers, but cannot accept requests from other remote clients?

  1. DB2 Personal Edition

  2. DB2 Workgroup Server Edition

  3. DB2Enterprise Server Edition

  4. DB2 Data Warehouse Edition


Correct Option: A

AI Explanation

To answer this question, we need to understand the different editions of DB2 and their capabilities.

Option A) DB2 Personal Edition - This option is correct because DB2 Personal Edition is designed for individual users and allows them to access other DB2 servers. However, it cannot accept requests from other remote clients.

Option B) DB2 Workgroup Server Edition - This option is incorrect because DB2 Workgroup Server Edition allows multiple users to access the database and can accept requests from remote clients.

Option C) DB2 Enterprise Server Edition - This option is incorrect because DB2 Enterprise Server Edition is the most comprehensive edition and supports multiple users and remote clients.

Option D) DB2 Data Warehouse Edition - This option is incorrect because DB2 Data Warehouse Edition is specifically designed for data warehousing purposes and supports multiple users and remote clients.

The correct answer is A) DB2 Personal Edition. This edition allows users to access other DB2 servers but cannot accept requests from other remote clients.

  1. DB2 Connect Enterprise Edition

  2. DB2 Workgroup Server Edition

  3. DB2 Workgroup Server Edition and DB2 Connect Enterprise Edition

  4. DB2Enterprise Server Edition and DB2 Connect Enterprise Edition


Correct Option: D

Which of the following is the lowest cost DB2 product that can be legally installed on an HP-UX server?

  1. DB2 Express-C

  2. DB2 Express

  3. DB2 Personal Edition

  4. DB2Enterprise Server Edition


Correct Option: D
- Hide questions