0

databases Online Quiz - 57

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

You want to use SQL*Plus to connect to the oracle database. Which of the following choices does not indicate a component you must specify when logging into the oracle?

  1. The SQL*Plus Keyword.

  2. The username

  3. The password

  4. The database name


Correct Option: D

AI Explanation

To answer this question, you need to understand the components required to connect to an Oracle database using SQL*Plus.

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

Option A) The SQL*Plus Keyword - This option is incorrect because you need to specify the SQL*Plus keyword, such as "sqlplus", to indicate that you want to use SQL*Plus for database connection.

Option B) The username - This option is correct because you must specify a valid username to connect to the Oracle database. The username identifies the user account that you want to use for the connection.

Option C) The password - This option is correct because you must provide the correct password associated with the specified username to establish a successful connection to the Oracle database.

Option D) The database name - This option is incorrect because you must specify the database name as part of the connection information. The database name identifies the specific Oracle database you want to connect to.

The correct answer is D) The database name. This option does not indicate a component you must specify when logging into the Oracle database using SQL*Plus.

  1. 17000.00

  2. 17000*****

  3. ****170.00

  4. **17000.00

  5. an error statement


Correct Option: C
Explanation:

To understand this SQL statement, the user should know about the LPAD function, which pads a string with a specified character until the string reaches a specified length. In this case, the salary column will be padded with asterisks (*) until it is 10 characters long.

The WHERE clause restricts the query to employees with an EMP_ID of 1001.

Assuming the employee with EMP_ID 1001 has a salary of 17000, the LPAD function will pad the salary with asterisks () until it has a length of 10 characters, resulting in the string "***17000". Therefore, the correct answer is:

The Answer is: A. ****170.00

  1. Convert any date literal to a date

  2. Convert any numeric literal to a date

  3. Convert any character literal to a date

  4. Convert any date to a character literal

  5. Format ’10-JAN-99’ to ‘January 10 1999’


Correct Option: C
Explanation:

To use the TO_DATE function, you need to know the purpose of the function and what it does. The TO_DATE function is used to convert a character string to a date format. The user needs to know that this function is used to convert a character string to a date format.

Now, let's evaluate each option to determine which one uses the TO_DATE function correctly:

A. Convert any date literal to a date - This option is incorrect. The TO_DATE function is used to convert character literals to a date format, not date literals.

B. Convert any numeric literal to a date - This option is incorrect. The TO_DATE function is used for character literals, not numeric literals.

C. Convert any character literal to a date - This option is correct. The TO_DATE function is used to convert character literals to a date format.

D. Convert any date to a character literal - This option is incorrect. The TO_CHAR function is used to convert dates to character literals, not the TO_DATE function.

E. Format ’10-JAN-99’ to ‘January 10 1999’ - This option is incorrect. The TO_CHAR function is used to format dates, not the TO_DATE function.

Therefore, the answer is: C. Convert any character literal to a date

Which one is a system privilege?

  1. select

  2. delete

  3. execute

  4. alter table

  5. create table


Correct Option: E

Which two are types of functions available in SQL?

  1. String

  2. Character

  3. Integer

  4. Calander

  5. Numeric

  6. Translation


Correct Option: B,E

Which two statements are true about constraints?

  1. The UNIQUE constraint does not permit a null value for the column.

  2. A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.

  3. The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.

  4. The NOT NULL constraint ensures that null values are not permitted for the column.


Correct Option: A,D

AI Explanation

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

Option A) The UNIQUE constraint does not permit a null value for the column. This option is correct. The UNIQUE constraint ensures that each value in the column is unique. It also does not permit a null value for the column, meaning that the column must have a non-null value for each row.

Option B) A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints. This option is incorrect. While it is true that a UNIQUE index is created for columns with UNIQUE constraints, it is not true for columns with PRIMARY KEY constraints. A PRIMARY KEY constraint automatically creates a unique index, but a UNIQUE constraint creates a separate unique index.

Option C) The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index. This option is incorrect. While it is true that a PRIMARY KEY constraint automatically creates a unique index, a FOREIGN KEY constraint does not create a unique index. A FOREIGN KEY constraint is used to establish a relationship between two tables.

Option D) The NOT NULL constraint ensures that null values are not permitted for the column. This option is correct. The NOT NULL constraint ensures that the column must have a non-null value for each row. It does not allow null values to be inserted into the column.

The correct answer is A and D. These options are correct because the UNIQUE constraint does not permit a null value for the column, and the NOT NULL constraint ensures that null values are not permitted for the column.

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;


Correct Option: D
  1. Unique

  2. Not null

  3. Check

  4. Primary key

  5. Foreign key


Correct Option: B

Which best describes an inline view?

  1. a schema object

  2. a subquery that can contain an ORDER BY clause

  3. another name for a view that contains group functions

  4. a subquery that is part of the FROM clause of another query


Correct Option: D
  1. no privileges

  2. only the SELECT privilege

  3. only the CONNECT privilege

  4. all the privileges of a default user


Correct Option: A

Which is iSQL*Plus commands?

  1. Insert

  2. Update

  3. Select

  4. Describe

  5. Delete

  6. Rename


Correct Option: D

Which SQL statement returns a numeric value?

  1. SELECT ADD_MONTHS(MAX(hire_Date), 6) FROM EMP;

  2. SELECT ROUND(hire_date)FROM EMP;

  3. SELECT sysdate-hire_date FROM EMP;

  4. SELECT TO_NUMBER(hire_date + 7)FROM EMP;


Correct Option: C

AI Explanation

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

Option A) SELECT ADD_MONTHS(MAX(hire_Date), 6) FROM EMP; This option calculates the maximum hire date from the EMP table and adds 6 months to it using the ADD_MONTHS function. The result is a date value, not a numeric value.

Option B) SELECT ROUND(hire_date) FROM EMP; This option rounds the hire_date column values to the nearest whole number. The result is a date value, not a numeric value.

Option C) SELECT sysdate-hire_date FROM EMP; This option subtracts the hire_date column values from the current date (sysdate) using the minus operator. The result of this subtraction operation is a numeric value representing the number of days between the hire date and the current date.

Option D) SELECT TO_NUMBER(hire_date + 7) FROM EMP; This option adds 7 days to the hire_date column values and then converts the result to a numeric value using the TO_NUMBER function. The result is a numeric value.

The correct answer is option C. This option returns a numeric value because it calculates the number of days between the hire date and the current date.

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, you need to understand the concept of object privileges and views.

A view is a virtual table that is based on the result of a query. It allows you to retrieve data from one or more tables as if it were a single table. When granting privileges on a view, you can specify which operations can be performed on the view.

Let's go through each option to understand which object privileges can be granted on a view:

Option A) None - This option is incorrect because object privileges can be granted on a view.

Option B) DELETE, INSERT, SELECT - This option is incorrect because it does not include the UPDATE privilege, which can be granted on a view.

Option C) ALTER, DELETE, INSERT, SELECT - This option is incorrect because it does not include the UPDATE privilege, which can be granted on a view.

Option D) DELETE, INSERT, SELECT, UPDATE - This option is correct because it includes all the object privileges that can be granted on a view. With these privileges, you can perform operations such as deleting, inserting, selecting, and updating data on the view.

The correct answer is option D.

  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


Correct Option: C,E

For which two constraints does the Oracle Server implicitly create a unique index?

  1. Not null

  2. Primary key

  3. Foreign key

  4. Check

  5. Unique


Correct Option: B,E

AI Explanation

To answer this question, we need to understand the concept of constraints in a database and how they relate to indexes.

Constraints are rules that are applied to columns or tables in a database to enforce data integrity. They ensure that the data stored in the database follows certain rules or conditions.

An index, on the other hand, is a data structure that improves the speed of data retrieval operations on a database table. It allows for faster searching and sorting of data.

In Oracle Server, there are several types of constraints that can be defined on a table, including:

A. Not null - This constraint ensures that a column cannot have a null value. B. Primary key - This constraint ensures that a column or a combination of columns uniquely identifies each row in a table. It implicitly creates a unique index on the primary key column(s). C. Foreign key - This constraint ensures that values in a column (or a set of columns) of one table match the values in another table's primary key or unique key column(s). D. Check - This constraint ensures that the values in a column meet a specific condition or set of conditions. E. Unique - This constraint ensures that the values in a column (or a set of columns) are unique across all rows in a table. It implicitly creates a unique index on the unique constraint column(s).

Based on the given options, the two constraints for which the Oracle Server implicitly creates a unique index are:

B. Primary key - This constraint ensures that a column or combination of columns uniquely identifies each row in a table. The Oracle Server implicitly creates a unique index on the primary key column(s). E. Unique - This constraint ensures that the values in a column (or a set of columns) are unique across all rows in a table. The Oracle Server implicitly creates a unique index on the unique constraint column(s).

Therefore, the correct answer is B and E.

What is generally the most efficient way to join to join two tables in the same database?

  1. In the database

  2. using a source qualifier transformation

  3. using a joiner transformation

  4. his cannot be done in Power Center 8.x


Correct Option: B
  1. Near to source

  2. Near to target

  3. Can be placed anywhere

  4. (i)Session performance is not affected


Correct Option: A

Which of the following transformation is passive and connected?

  1. Aggregator

  2. Expression

  3. Joiner

  4. Filter


Correct Option: B

Which of the below transformation can be used as connected and unconnected both way?

  1. Stored procedure, Look up

  2. Stored procedure, filter

  3. Look up , joiner

  4. Filter, Expression


Correct Option: A

Which of the following task can be made reusable?

  1. Session

  2. Command

  3. Email

  4. All of the above


Correct Option: D
- Hide questions