0

databases Online Quiz - 187

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

Among this which is Not a SQL Aggregate Functions ?

  1. FIRST()

  2. AVG()

  3. LAST()

  4. COUNT()

  5. None of these


Correct Option: E

SQL scalar functions return a single value, Among this which is Not a scalar functions?

  1. FORMAT()

  2. ROUND()

  3. UCASE()

  4. AVG()


Correct Option: D

Which function is used to extract characters from a text field?

  1. len()

  2. MID()

  3. FORMAT()

  4. NOW()


Correct Option: B

SQL1715 error means?

  1. Failed to validate subquery

  2. Failed to validate CASE expression

  3. Failed to validate column list

  4. Failed to validate foreign key.


Correct Option: A

SQL1707 error means?

  1. Failed to validate IN predicate

  2. Failed to validate HAVING clause

  3. Failed to validate CASE expression

  4. None of these


Correct Option: B

SQL3008 error means?

  1. SOCKET WRITE ERROR

  2. SESSION TIMEOUT

  3. SOCKET READ ERROR

  4. HEADER NOT FOUND


Correct Option: C

AI Explanation

To answer this question, we need to understand the SQL3008 error in SQL.

The SQL3008 error is related to a socket read error. This error occurs when there is a problem with reading data from the socket during a database operation. It indicates that there was an issue in communication between the client and the server, specifically with reading data from the socket.

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

Option A) SOCKET WRITE ERROR - This option is incorrect because the SQL3008 error is related to a socket read error, not a socket write error.

Option B) SESSION TIMEOUT - This option is incorrect because the SQL3008 error is not related to a session timeout. It is specifically related to a socket read error.

Option C) SOCKET READ ERROR - This option is correct. The SQL3008 error is indeed related to a socket read error.

Option D) HEADER NOT FOUND - This option is incorrect. The SQL3008 error is not related to a header not found, but rather a socket read error.

The correct answer is C) SOCKET READ ERROR. This option is correct because the SQL3008 error indicates a problem with reading data from the socket during a database operation.

SQL3009 error means?

  1. HEADER TOO LONG

  2. HEADER NOT FOUND

  3. SOCKET READ ERROR

  4. SOCKET WRITE ERROR


Correct Option: D

SQL3011 error means?

  1. SESSION TIMEOUT

  2. INVALID SESSION TICKET

  3. SOCKET WRITE ERROR

  4. FAILED TO EXECUTE GRANT COMMAND


Correct Option: A

AI Explanation

To answer this question, we need to understand what the SQL3011 error typically indicates.

Option A) SESSION TIMEOUT - This option is incorrect. The SQL3011 error does not specifically refer to a session timeout. It is important to note that session timeouts are usually handled separately by the server or application.

Option B) INVALID SESSION TICKET - This option does not relate to the SQL3011 error. An invalid session ticket would typically result in a different error code or message.

Option C) SOCKET WRITE ERROR - This option does not match the SQL3011 error. A socket write error would typically be indicated by a different error code or message.

Option D) FAILED TO EXECUTE GRANT COMMAND - This option does not align with the SQL3011 error. A failure to execute a grant command would usually result in a different error code or message.

The correct answer is A) SESSION TIMEOUT. This option is correct because the SQL3011 error generally indicates that the session has timed out. This means that the session has been inactive for a period of time and has been automatically terminated by the server.

What is ACID property?

  1. Atomicity,Consistency,Isolation and Durability

  2. Atomicity,Concurrently,Isolation,Durability

  3. Atomicity,Consistency,Incremental,Durability

  4. Atomicity,Concurrently,Incremental,Durability


Correct Option: A

In which scenario would index be most useful?

  1. The indexed column is declared as NOT NULL

  2. The indexed columns are used in the FROM clause

  3. The indexed columns are part of an expression

  4. The indexed column contains a wide range of values


Correct Option: D
Explanation:

To answer this question, the user needs to know what an index is and how it works.

An index is a data structure that improves the speed of data retrieval operations on a database table. It does this by providing a quick lookup mechanism for finding rows that match certain column values in the table. Indexes are most useful when searching large tables for a specific value or set of values.

Now, let's go through each option and explain why it is right or wrong:

A. The indexed column is declared as NOT NULL: This option is not necessarily the most useful scenario for an index. Declaring a column as NOT NULL simply means that the column cannot contain NULL values. While this may improve data integrity, it does not necessarily make an index more useful.

B. The indexed columns are used in the FROM clause: This option is not necessarily the most useful scenario for an index, either. Using indexed columns in the FROM clause can help improve query performance by allowing the database to retrieve only the necessary rows. However, it does not necessarily make the index more useful than other scenarios.

C. The indexed columns are part of an expression: This option can be useful for an index. When indexed columns are part of an expression, the database can still use the index to search for values that match the expression. This can help improve query performance.

D. The indexed column contains a wide range of values: This option is the most useful scenario for an index. When a column contains a wide range of values, it can be difficult for the database to search through all the values to find the ones that match a specific criteria. However, if the column is indexed, the database can use the index to quickly find the values that match the criteria, which can greatly improve query performance.

Therefore, the correct answer is:

The Answer is: D

Which clause would you use in a SELECT statement to limit the display to those employees whose salary is greater then 5000?

  1. ORDER BY SALARY > 5000

  2. GROUP BY SALARY > 5000

  3. HAVING SALARY > 5000

  4. WHERE SALARY > 5000


Correct Option: D
Explanation:

To solve this question, the user needs to know the basic syntax of a SELECT statement in SQL, including the purpose of each clause.

The WHERE clause is used to filter the rows returned by a query based on specified conditions. In this case, we want to limit the display to only those employees whose salary is greater than 5000. Therefore, the correct answer is:

The Answer is: D. WHERE SALARY > 5000

Option A, ORDER BY SALARY > 5000 is incorrect because the ORDER BY clause is used to sort the rows returned by a query in ascending or descending order based on a specified column. It is not used to filter rows based on specific conditions.

Option B, GROUP BY SALARY > 5000 is incorrect because the GROUP BY clause is used to group the rows returned by a query based on one or more columns. It is not used to filter rows based on specific conditions.

Option C, HAVING SALARY > 5000 is incorrect because the HAVING clause is used to filter the rows returned by a query based on conditions that involve aggregate functions, such as SUM, COUNT, AVG, MAX, and MIN. It is not used to filter rows based on specific conditions.

When should you create a role? (Choose two)

  1. To simplify the process of creating new users using the CREATE USER xxx IDENTIFIED by yyy statement

  2. To grant a group of related privileges to a user

  3. When the number of people using the database is very high

  4. To simplify the process of granting and revoking privileges


Correct Option: C,D

Which four are correct guidelines for naming database tables? (Choose four)

  1. Must begin with either a number or a letter

  2. Must be 1-30 characters long

  3. Should not be an Oracle Server reserved word

  4. Must contain only A-Z, a-z, 0-+, _, *, and #.

  5. Must contain only A-Z, a-z, 0-9, _, $, and #.

  6. Must begin with a letter


Correct Option: B,C,E,F

AI Explanation

To answer this question, you need to understand the guidelines for naming database tables. Let's go through each option to understand why it is correct or incorrect:

Option A) Must begin with either a number or a letter - This option is incorrect because database table names can begin with either a number or a letter.

Option B) Must be 1-30 characters long - This option is correct because database table names typically have a length restriction, and it is common for them to be 1-30 characters long.

Option C) Should not be an Oracle Server reserved word - This option is correct because it is important to avoid using Oracle Server reserved words as table names to prevent conflicts and confusion.

Option D) Must contain only A-Z, a-z, 0-+, _, *, and # - This option is incorrect because database table names can typically contain more characters than just A-Z, a-z, 0-+, _, *, and #.

Option E) Must contain only A-Z, a-z, 0-9, , $, and # - This option is correct because database table names generally allow a combination of letters (A-Z, a-z), numbers (0-9), underscore (), dollar sign ($), and hash (#).

Option F) Must begin with a letter - This option is correct because database table names typically begin with a letter.

The correct answers are B, C, E, and F. These options are correct because they follow the guidelines for naming database tables.

Which operator can be used with a multiple-row subquery

  1. =

  2. LIKE

  3. BETWEEN

  4. NOT IN

  5. IS

  6. <>


Correct Option: D

You need to perform certain data manipulation operations through a view called EMP_DEPT_VU, which you previously created. You want to look at the definition of the view (the SELECT statement on which the view was create.) How do you obtain the definition of the view

  1. Use the DESCRIBE command in the EMP_DEPT VU view

  2. Use the DEFINE VIEW command on the EMP_DEPT VU view

  3. Use the DESCRIBE VIEW command on the EMP_DEPT VU view

  4. Query the USER_VIEWS data dictionary view to search for the EMP_DEPT_VU view

  5. Query the USER_SOURCE data dictionary view to search for the EMP_DEPT_VU view

  6. Query the USER_OBJECTS data dictionary view to search for the EMP_DEPT_VU view


Correct Option: D

Which two are character manipulation functions? (Choose two.)

  1. TRIM

  2. REPLACE

  3. TRUNC

  4. TO_DATE

  5. MOD

  6. CASE


Correct Option: A,B

AI Explanation

To answer this question, we need to understand the functions and their purpose in character manipulation.

Option A) TRIM - This option is correct. The TRIM function is used to remove specified characters (usually spaces) from the beginning and end of a string.

Option B) REPLACE - This option is correct. The REPLACE function is used to replace a specified substring within a string with another substring.

Option C) TRUNC - This option is incorrect. The TRUNC function is used to truncate a number to a specified number of decimal places.

Option D) TO_DATE - This option is incorrect. The TO_DATE function is used to convert a string to a date value.

Option E) MOD - This option is incorrect. The MOD function is used to calculate the remainder of a division operation.

Option F) CASE - This option is incorrect. The CASE statement is used for conditional logic and does not manipulate characters directly.

The correct answers are A) TRIM and B) REPLACE. These functions are used for character manipulation by removing specified characters or replacing substrings within a string.

Which three statements correctly describe the functions and use of constraints? (Choose three.)

  1. Constraints provide data independence

  2. Constraints make complex queries easy

  3. Constraints enforce rules at the view level

  4. Constraints enforce rules at the table level

  5. Constraints prevent the deletion of a table if there are dependencies

  6. Constraints prevent the deletion of an index if there are dependencies


Correct Option: C,D,E

AI Explanation

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

Option A) Constraints provide data independence - This option is incorrect because constraints do not provide data independence. Data independence refers to the ability to modify the schema definition without affecting the application programs that use the database. Constraints, on the other hand, are used to enforce rules and maintain data integrity.

Option B) Constraints make complex queries easy - This option is incorrect because constraints do not make complex queries easy. Constraints are used to enforce rules and maintain data integrity, but they do not directly impact the complexity of queries.

Option C) Constraints enforce rules at the view level - This option is correct. Constraints can be defined at the view level to enforce rules on the data displayed by the view. This ensures that only valid data is shown to the users.

Option D) Constraints enforce rules at the table level - This option is correct. Constraints are commonly defined at the table level to enforce rules on the data stored in the table. This ensures that only valid data is stored in the table.

Option E) Constraints prevent the deletion of a table if there are dependencies - This option is correct. Constraints can be used to define dependencies between tables. If there are dependencies, such as foreign key constraints, a table cannot be deleted unless the dependencies are resolved first.

Option F) Constraints prevent the deletion of an index if there are dependencies - This option is incorrect. Constraints do not prevent the deletion of an index. Indexes are used to improve query performance and do not have dependencies like tables.

Therefore, the correct statements about the functions and use of constraints are:

C) Constraints enforce rules at the view level D) Constraints enforce rules at the table level E) Constraints prevent the deletion of a table if there are dependencies

You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator "=". What happens when the main query is executed?

  1. The main query executes with the first value returned by the subquery

  2. The main query executes with the last value returned by the subquery

  3. The main query executes with all the values returned by the subquery

  4. The main query fails because the multiple-row subquery cannot be used with the comparison operator

  5. You cannot define a multiple-row subquery in the WHERE clause of a SQL query


Correct Option: D

What is true about joining tables through an equijoin

  1. You can join a maximum of two tables through an equijoin

  2. You can join a maximum of two columns through an equijoin

  3. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT statement

  4. To join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns.

  5. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.


Correct Option: E
Explanation:

To understand the concept of equijoin, the user should know the basics of SQL and joins. An equijoin is a type of join that combines columns from two or more tables based on their equality.

Let's go through each option and explain whether it is true or false:

A. You can join a maximum of two tables through an equijoin

  • This statement is false. You can join more than two tables through an equijoin.

B. You can join a maximum of two columns through an equijoin

  • This statement is false. You can join more than two columns through an equijoin.

C. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT statement

  • This statement is false. You specify an equijoin condition in the WHERE clause of a SELECT statement.

D. To join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns.

  • This statement is false. The columns in the join condition need not be primary key and foreign key columns; they can be any columns that have the same data type and contain the same values.

E. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.

  • This statement is true. If you want to join n tables, you need to specify a minimum of n-1 join conditions.

The Answer is: E

Which clause should you use to exclude group results?

  1. WHERE

  2. HAVING

  3. RESTRICT

  4. GROUP BY

  5. ORDER BY


Correct Option: B
- Hide questions