0

databases Online Quiz - 43

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

Given below, What is the maximum level of data protection

  1. RAID 1 and Fallback

  2. RAID 5 and Fallback

  3. RAID 5 and No Fallback

  4. RAID 1 and No Fallback


Correct Option: A

AI Explanation

To answer this question, we need to understand the concept of RAID (Redundant Array of Independent Disks) and data protection levels associated with it.

RAID is a technology that combines multiple physical disk drives into a single logical unit to improve performance, reliability, and data protection. Different RAID levels provide different levels of data protection, depending on the redundancy and fault tolerance mechanisms they employ.

Now, let's go through each option to understand why it is correct or incorrect:

Option A) RAID 1 and Fallback - This option is correct because RAID 1, also known as mirroring, provides the highest level of data protection. In RAID 1, data is mirrored across multiple drives, meaning that each drive contains an exact copy of the data. This redundancy ensures that even if one drive fails, the data can still be accessed from the other drive. Fallback refers to the ability to switch to a backup or redundant system in case of failure, further enhancing data protection.

Option B) RAID 5 and Fallback - This option is incorrect because RAID 5 does not provide the maximum level of data protection. RAID 5 uses striping with parity, distributing data and parity across multiple drives. While it offers some fault tolerance by allowing the system to continue functioning even if one drive fails, it does not provide the same level of redundancy as RAID 1.

Option C) RAID 5 and No Fallback - This option is incorrect for the same reasons mentioned above. RAID 5 without fallback does not provide the maximum level of data protection.

Option D) RAID 1 and No Fallback - This option is incorrect because while RAID 1 offers a high level of data protection, not having fallback limits the ability to switch to a backup or redundant system in case of failure, reducing the overall level of data protection.

Therefore, the correct answer is A) RAID 1 and Fallback. This option provides the maximum level of data protection by combining the redundancy of RAID 1 with the ability to switch to a backup or redundant system in case of failure.

Which statement is true if using NUPIs to accomplish data distribution?

  1. The increase of hash buckets has resulted in more hash collisions.

  2. Duplicate NUPI values will produce the same row hash.

  3. Uniform row distribution is accomplished using UPIs.

  4. The low-order 16 bits of the row hash are input to the hash map.


Correct Option: B

AI Explanation

To answer this question, we need to understand the concept of NUPIs (Non-Unique Primary Index) and how they are used for data distribution in a database.

Option A) The statement "The increase of hash buckets has resulted in more hash collisions" is incorrect. Increasing the number of hash buckets reduces the likelihood of hash collisions, as it provides more space for the data to be distributed evenly.

Option B) The statement "Duplicate NUPI values will produce the same row hash" is correct. In a database using NUPIs, rows with duplicate NUPI values will be hashed to the same hash bucket. This ensures that rows with the same NUPI value are stored together for efficient access.

Option C) The statement "Uniform row distribution is accomplished using UPIs" is incorrect. UPIs (Unique Primary Index) are used for unique row identification, not for achieving uniform row distribution. NUPIs are typically used for data distribution across multiple AMPs (Access Module Processors) in the Teradata database.

Option D) The statement "The low-order 16 bits of the row hash are input to the hash map" is not directly related to NUPIs or data distribution. It seems to be discussing a specific implementation detail that is not relevant to the given question.

Based on the explanations above, the correct answer is Option B. Duplicate NUPI values will produce the same row hash, ensuring that rows with the same NUPI value are stored together for efficient access.

What option can best describe Teradata's architecture

  1. Shared nothing

  2. Shared memory

  3. Shared everything

  4. shared data


Correct Option: A

Why to Choose a Non Unique primary index instead of a unique primary index

  1. A Non Unique primary index may be more effective for query access and joins

  2. A NUPI query simplifies the optimization process in the PE

  3. A NUPI provides better data distribution

  4. A NUPI requires less disk space to store the data row


Correct Option: A

When utilizing a unique secondary index, how many AMP(s) are most probably accessed

  1. 1 AMP

  2. Multi - AMP

  3. 2 -AMP

  4. All-AMP


Correct Option: C

Temporary space is

  1. assigned at the table level

  2. permanent space currently not used

  3. spool space currently not used

  4. subtracted form sysadmin


Correct Option: B

Which is the component limits queries based on set thresholds?

  1. Teradata Manager

  2. TDQM

  3. BTEQ

  4. QueryMan


Correct Option: B

Sybase char_length equialent of SQL is

  1. length

  2. char_length

  3. char_len

  4. len


Correct Option: D

AI Explanation

To answer this question, we need to understand the Sybase database and its equivalent functions.

The Sybase equivalent function for the SQL char_length is len.

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

Option A) length - This option is incorrect because length is not the Sybase equivalent function for char_length.

Option B) char_length - This option is incorrect because char_length is not the Sybase equivalent function for char_length.

Option C) char_len - This option is incorrect because char_len is not the Sybase equivalent function for char_length.

Option D) len - This option is correct because len is the Sybase equivalent function for char_length.

The correct answer is Option D. This option is correct because len is the Sybase equivalent function for char_length.

How to change <> null in sybase to SQL?

  1. is not null

  2. is null

  3. != null

  4. <> null


Correct Option: A

" in sybase is changed to ' in sql

  1. True

  2. False


Correct Option: A

exp1 LIKE exp2 in sybase is changed to

  1. exp1 like exp2

  2. exp1 like ltrim(exp2)

  3. exp1 like rtrim(exp2)

  4. ltrim(exp1) like exp2


Correct Option: C

*= operator belongs to SQL server 2008

  1. True

  2. False


Correct Option: B

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table?

  1. INSERT INTO employees VALUES (NULL, 'JOHN','Smith');

  2. INSERT INTO employees( first_name, last_name) VALUES ('JOHN','Smith');

  3. INSERT INTO employees VALUES ('1000','JOHN','NULL');

  4. INSERT INTO employees(first_name,last_name, employee_id) VALUES ('1000, 'john','Smith');


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) INSERT INTO employees VALUES (NULL, 'JOHN','Smith'); This option is incorrect because it tries to insert a NULL value for the primary key column EMPLOYEE_ID. Since EMPLOYEE_ID is defined as the primary key, it cannot have a NULL value.

Option B) INSERT INTO employees(first_name, last_name) VALUES ('JOHN','Smith'); This option is incorrect because it only specifies the values for the columns FIRST_NAME and LAST_NAME, but it does not specify a value for the primary key column EMPLOYEE_ID. Since EMPLOYEE_ID is defined as the primary key, it must have a value specified during the insertion.

Option C) INSERT INTO employees VALUES ('1000','JOHN','NULL'); This option is correct because it specifies values for all columns - EMPLOYEE_ID, FIRST_NAME, and LAST_NAME. The value '1000' is inserted into the EMPLOYEE_ID column, and the values 'JOHN' and 'NULL' are inserted into the FIRST_NAME and LAST_NAME columns, respectively.

Option D) INSERT INTO employees(first_name,last_name, employee_id) VALUES ('1000, 'john','Smith'); This option is incorrect because it specifies the column names in the wrong order. It tries to insert '1000' into the FIRST_NAME column, 'john' into the LAST_NAME column, and 'Smith' into the EMPLOYEE_ID column. The column names and values do not match correctly.

The correct answer is C. This option correctly inserts a row into the EMPLOYEES table by specifying values for all columns in the correct order.

You need to give the MANAGER role the ability to select from, insert into, and modify existing rows in the STUDENT_GRADES table. Anyone given this MANAGER role should be able to pass those privileges on to others. Which statement accomplishes this?

  1. GRANT select, insert, update ON student_grades TO manager

  2. GRANT select, insert, update ON student_grades TO ROLE manager

  3. GRANT select, insert, modify ON student_grades TO manager WITH GRANT OPTION;

  4. GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION;


Correct Option: D
Explanation:

To solve this question, the user needs to understand SQL syntax for granting privileges to a specific role or user.

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

A. GRANT select, insert, update ON student_grades TO manager

This option grants SELECT, INSERT, and UPDATE privileges on the STUDENT_GRADES table to a user named "manager". However, it does not grant the ability to pass on these privileges to others.

B. GRANT select, insert, update ON student_grades TO ROLE manager

This option is similar to Option A, but grants privileges to a role named "manager" instead of a specific user. However, it still does not grant the ability to pass on these privileges to others.

C. GRANT select, insert, modify ON student_grades TO manager WITH GRANT OPTION;

This option is incorrect because there is no "MODIFY" privilege in SQL. It should be "UPDATE" instead.

D. GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION;

This option is correct. It grants SELECT, INSERT, and UPDATE privileges on the STUDENT_GRADES table to a user named "manager" and also includes the "WITH GRANT OPTION" clause, which allows this user to pass on these privileges to others.

Therefore, the correct answer is:

The Answer is: D

The database administrator of your company created a public synonym called HR for the HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a user of the database, you created a table called HR in your schema. What happens when you execute this query? SELECT * FROM HR;

  1. You obtain the results retrieved from the public synonym HR created by the database administrator.

  2. You obtain the results retrieved from the HR table that belongs to your schema.

  3. You get an error message because you cannot retrieve from a table that has the same name as a public

  4. You obtain the results retrieved from both the public synonym HR and the HR table that belongs to


Correct Option: B

Which statement about views are true?

  1. A view can be created as read only.

  2. A view cannot have an ORDER BY clause in the SELECT statement.

  3. A view cannot be created with a GROUP BY clause in the SELECT statement.

  4. A view must have aliases defined for the column names in the SELECT statement.


Correct Option: A

AI Explanation

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

Option A) A view can be created as read-only - This option is correct. A view can be created with the READ ONLY clause, which restricts any modifications to the underlying data. Users can only query the view and cannot perform any DML (Data Manipulation Language) operations on it.

Option B) A view cannot have an ORDER BY clause in the SELECT statement - This option is incorrect. A view can have an ORDER BY clause in the SELECT statement. The ORDER BY clause is used to sort the result set returned by the view.

Option C) A view cannot be created with a GROUP BY clause in the SELECT statement - This option is incorrect. A view can be created with a GROUP BY clause in the SELECT statement. The GROUP BY clause is used to group rows based on specified columns and perform aggregate functions on each group.

Option D) A view must have aliases defined for the column names in the SELECT statement - This option is incorrect. While it is a good practice to provide aliases for column names in a view, it is not mandatory. If aliases are not provided, the column names in the view will inherit the column names from the underlying tables.

The correct answer is Option A) A view can be created as read-only. This option is correct because a view can be explicitly created as read-only, preventing any modifications to the underlying data.

Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) JOB_CAT VARCHARD2(30) SALARY NUMBER(8,2) Which statement shows the maximum salary paid in each job category of each department?

  1. SELECT dept_id, job_cat, MAX(salary)

  2. ELECT dept_id, job_cat, MAX(salary)

  3. SELECT dept_id, MAX(salary)

  4. SELECT dept_id, salary


Correct Option: B

AI Explanation

To find the maximum salary paid in each job category of each department from the EMPLOYEES table, we need to group the data by department and job category and then find the maximum salary within each group.

The correct statement to achieve this is:

B. SELECT dept_id, job_cat, MAX(salary)

Explanation:

Option A) SELECT dept_id, job_cat, MAX(salary) - This option includes all the necessary columns and the MAX(salary) function to find the maximum salary. This is the correct statement.

Option B) SELECT dept_id, job_cat, MAX(salary) - This option is the correct statement as it includes all the necessary columns and the MAX(salary) function to find the maximum salary.

Option C) SELECT dept_id, MAX(salary) - This option does not include the job_cat column, so it will not show the maximum salary per job category. Therefore, this option is incorrect.

Option D) SELECT dept_id, salary - This option does not include the MAX(salary) function to find the maximum salary. It will simply display the salary column for each department. Therefore, this option is incorrect.

The correct answer is B. SELECT dept_id, job_cat, MAX(salary). This statement includes all the necessary columns and the MAX(salary) function to find the maximum salary paid in each job category of each department.

Management has asked you to calculate the value 12*salary* commission_pct for all the employees in the EMP table. The EMP table contains these columns: LAST NAME VARCNAR2(35) NOT NULL SALARY NUMBER(9,2) NOT NULL COMMISION_PCT NUMBER(4,2) Which statement ensures that a value is displayed in the calculated columns for all employees?

  1. SELECT last_name, 12*salary* commission_pct FROM emp;

  2. SELECT last_name, 12*salary* (commission_pct,0) FROM emp;

  3. SELECT last_name, 12*salary*(nvl(commission_pct,0)) FROM emp;

  4. SELECT last_name, 12*salary*(decode(commission_pct,0)) FROM emp;


Correct Option: C
Explanation:

To solve this question, the user needs to know SQL syntax and the concept of NULL values. The user must use the proper SQL function to ensure that all employees' values are displayed in the calculated columns.

Option A: SELECT last_name, 12*salary* commission_pct FROM emp; This option is incorrect because it does not handle NULL values. If any employee has a NULL value in the commission_pct column, the entire expression would result in NULL, and no value would be displayed.

Option B: SELECT last_name, 12*salary* (commission_pct,0) FROM emp; This option is incorrect because it contains a syntax error. The expression (commission_pct, 0) is not valid SQL syntax.

Option C: SELECT last_name, 12*salary*(nvl(commission_pct,0)) FROM emp; This option is correct. The NVL function is used to handle NULL values in the commission_pct column. The function replaces any NULL value with 0, ensuring that all employees have a value in the calculated column.

Option D: SELECT last_name, 12*salary*(decode(commission_pct,0)) FROM emp; This option is incorrect because the DECODE function is not used correctly. The DECODE function should have a second argument to return if the first argument is not equal to 0. Without the second argument, the function would not handle any non-zero values in the commission_pct column.

Therefore, the correct answer is:

The Answer is: C. SELECT last_name, 12*salary*(nvl(commission_pct,0)) FROM emp;

Examine the description of the STUDENTS table: STD_ID NUMBER(4) COURSE_ID VARCHARD2(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. AVG(start_date, end_date)


Correct Option: C
Explanation:

Explanation: Aggregate functions operate on a set of rows and return a single result. The two valid aggregate functions on the START_DATE column are: C. COUNT(start_date) - This function returns the number of rows where START_DATE is not null.

Option A is invalid because the SUM function is used to add numeric values and cannot be used with a DATE data type. Option B is invalid because the AVG function will not work with DATE, you can convert DATE to NUMERIC then it can be used, but without Casting it will not work Option D is invalid because the AVG function can only be used with a single column, and the argument passed in should be numeric.

The EMPLOYEE tables has these columns: LAST_NAME VARCHAR2(35) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(5,2) You want to display the name and annual salary multiplied by the commission_pct for all employees. For records that have a NULL commission_pct, a zero must be displayed against the calculated column. Which SQL statement displays the desired results?

  1. SELECT last_name, (salary * 12) * commission_pct FROM EMPLOYEES;

  2. SELECT last_name, (salary * 12) * IFNULL(commission_pct, 0) FROM EMPLOYEES;

  3. SELECT last_name, (salary * 12) * NVL2(commission_pct, 0) FROM EMPLOYEES;

  4. SELECT last_name, (salary * 12) * NVL(commission_pct, 0) FROM EMPLOYEES;


Correct Option: D
Explanation:

Explanation: To display the name and annual salary multiplied by the commission_pct for all employees, we need to use the multiplication (*) operator. For records that have a NULL commission_pct, a zero must be displayed against the calculated column, we need to use the NVL function.

Option A) SELECT last_name, (salary * 12) * commission_pct FROM EMPLOYEES; This option is incorrect because it does not account for NULL commission_pct values and does not use the NVL function.

Option B) SELECT last_name, (salary * 12) * IFNULL(commission_pct, 0) FROM EMPLOYEES; This option is incorrect because the IFNULL function is not valid in Oracle SQL, and it does not use the NVL function.

Option C) SELECT last_name, (salary * 12) * NVL2(commission_pct, 0) FROM EMPLOYEES; This option is incorrect because the NVL2 function is not valid in Oracle SQL. It should be replaced with the NVL function.

Option D) SELECT last_name, (salary * 12) * NVL(commission_pct, 0) FROM EMPLOYEES; This option is correct because it uses the multiplication operator to calculate the annual salary multiplied by the commission_pct and the NVL function to handle NULL commission_pct values.

Therefore, the correct answer is D.

- Hide questions