0

databases Online Quiz - 200

Description: databases Online Quiz - 200
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0
  1. Immediately after the SELECT clause

  2. After the ORDER BY clause

  3. After the WHERE clause

  4. Before the WHERE clause


Correct Option: C
  1. SELECT SUBSTR( ‘Hello World’,1) FROM dual;

  2. SELECT INITCAP(TRIM (‘Hello World’, 1,1)) FROM dual;

  3. SELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;

  4. SELECT LOWER(SUBSTR(‘Hello World’, 2, 1) FROM dual;


Correct Option: C
Explanation:

To solve this question, the user needs to know the basic SQL functions and how they can be applied to strings. The user must evaluate each option and determine which one will result in the desired output of 'ello world' from the given string 'Hello World'.

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

A. SELECT SUBSTR( ‘Hello World’,1) FROM dual;

This option selects a substring from the given string starting at the first character. Since the starting point is at the first character, the entire string 'Hello World' will be returned. Therefore, this option is incorrect.

B. SELECT INITCAP(TRIM (‘Hello World’, 1,1)) FROM dual;

This option capitalizes the first letter of the given string and removes any leading or trailing spaces. However, the second and third parameters of the TRIM function are invalid and will cause an error. Therefore, this option is also incorrect.

C. SELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;

This option removes the letter 'H' from the given string, converts it to lowercase, and removes any leading or trailing spaces. The resulting string will be 'ello world', which is the desired output. Therefore, this option is correct.

D. SELECT LOWER(SUBSTR(‘Hello World’, 2, 1) FROM dual;

This option selects a substring from the given string starting at the second character and ending after one character. The resulting substring will be 'e'. This substring is then converted to lowercase. Therefore, this option is incorrect.

The Answer is: C. SELECT LOWER(TRIM (‘H’ FROM ‘Hello World’)) FROM dual;

  1. SELECT ename, salary*12 ‘Annual Salary’ FROM employees;

  2. SELECT ename, salary*12 “Annual Salary” FROM employees;

  3. SELECT ename, salary*12 AS Annual Salary FROM employees;

  4. SELECT ename, salary*12 AS INITCAP(“ANNUAL SALARY”) FROM employees


Correct Option: B

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

  1. ORDER BY SALARY > 5000

  2. GROUP BY SALARY > 5000

  3. HAVING SALARY > 5000

  4. WHERE SALARY > 5000


Correct Option: D
  1. SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;

  2. SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;

  3. SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;

  4. SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;


Correct Option: A
Explanation:

To solve this question, the user needs to know the SQL syntax for extracting specific parts of a date and formatting date values. The user must use the correct function to extract the year from the system date and format it as "1998".

Option A is correct. This option uses the TO_CHAR function to convert the system date to a character string in the format specified by the second argument ('yyyy' in this case). This function extracts the year from the system date and formats it as a 4-digit string. The output will be "1998".

Option B is incorrect. This option uses the TO_DATE function, which is used to convert a character string to a date value. In this case, the first argument is already a date value, so using TO_DATE is unnecessary. Also, the second argument ('yyyy') specifies the format of the output, not the input.

Option C is incorrect. This option uses the DECODE function to extract the year from the system date. However, the syntax is incorrect. DECODE requires at least three arguments: the first is the value to be compared, the second is the comparison value, and the third is the result if the comparison is true. In this case, the first argument (SUBSTR(SYSDATE, 8)) is missing a second argument to compare it to.

Option D is incorrect. This option also uses the DECODE function, but the syntax is incorrect. The SUBSTR function extracts a substring from the system date starting at position 8, which is the day of the month. There is no 'year' substring in this position, so the output will not be correct.

The Answer is: A. SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;

  1. You want to identify the most senior employee in the company.

  2. You want to find the manager supervising the largest number of employees

  3. You want to identify the person who makes the highest salary for all employees.

  4. You want to rank the top three sales representatives who have sold the maximum


Correct Option: D
Explanation:

To determine the best solution for TOP N analysis, the user must understand what TOP N analysis is and the context in which it can be applied. TOP N analysis is a method of ranking data by selecting the top N items based on a specific criterion. The user should choose option D because it requires identifying the top three sales representatives who have sold the maximum, which is a typical use case for TOP N analysis.

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

A. You want to identify the most senior employee in the company. This option is wrong because identifying the most senior employee does not require ranking or selecting the top N employees based on a specific criterion. It only involves identifying one employee based on their seniority level.

B. You want to find the manager supervising the largest number of employees. This option is wrong because finding the manager supervising the largest number of employees does not require ranking or selecting the top N employees based on a specific criterion. It only involves identifying one manager based on the number of employees they supervise.

C. You want to identify the person who makes the highest salary for all employees. This option is wrong because identifying the person who makes the highest salary does not require ranking or selecting the top N employees based on a specific criterion. It only involves identifying one employee based on their salary level.

D. You want to rank the top three sales representatives who have sold the maximum. This option is correct because identifying the top three sales representatives who have sold the maximum requires ranking and selecting the top N employees based on a specific criterion (sales revenue), which is a typical use case for TOP N analysis.

Therefore, the answer is: D.

Primary Index can not be

  1. Null

  2. dropped

  3. have duplicates

  4. All of the above


Correct Option: B
  1. SSAS

  2. SSIS

  3. SSRS

  4. SQL RDBMS


Correct Option: C
Explanation:

To answer this question, the user needs to have an understanding of the Microsoft SQL BI tool components and their respective functionalities.

SSAS (SQL Server Analysis Services) is a component of the Microsoft SQL BI tool that enables data analysis and mining by creating OLAP cubes. It is not used for creating or rendering reports.

SSIS (SQL Server Integration Services) is a component of the Microsoft SQL BI tool that is used to perform data integration tasks such as data extraction, transformation, and loading. It is not used for creating or rendering reports.

SSRS (SQL Server Reporting Services), on the other hand, is a component of the Microsoft SQL BI tool that supports the creation and rendering of reports. It provides a platform for designing, publishing, and delivering reports to end-users. Therefore, option C is the correct answer.

SQL RDBMS (Relational Database Management System) is a general term that refers to software systems used to manage relational databases. It is not a specific component of the Microsoft SQL BI tool and does not support the creation or rendering of reports.

Therefore, the answer is: C. SSRS.

  1. A method of storing and presenting key enterprise data

  2. Allows End users to analyze data to understand business results

  3. To accurately forecast future results

  4. All of the above


Correct Option: D
Explanation:

To understand the concept of Business Intelligence, it is the process of transforming data into actionable insights to help businesses make informed decisions.

To answer this question, the user must know the definition of Business Intelligence. Now, let's go through each option and explain why it is right or wrong:

A. A method of storing and presenting key enterprise data: This option is partially correct, but it does not encompass the entire concept of Business Intelligence. While storage and presentation of enterprise data is a part of BI, it is not the full picture.

B. Allows End users to analyze data to understand business results: This option is also partially correct. BI tools allow end-users to analyze data to understand business results. But again, it is not the complete definition of BI.

C. To accurately forecast future results: This option is incorrect. While BI can help businesses forecast future results, it is not the sole purpose of BI.

D. All of the above: This option is the correct answer. Business Intelligence involves storing and presenting data, analyzing data to understand business results, and accurately forecasting future results. Therefore, option D is the correct answer.

The Answer is: D

  1. SSAS

  2. SSIS

  3. SSRS

  4. SQL RDBMS


Correct Option: B
Explanation:

To answer this question, the user needs to be familiar with the Microsoft SQL BI toolset and its components.

A. SSAS (SQL Server Analysis Services) is a service that performs online analytical processing (OLAP) and data mining functionalities. It is used for creating and managing data models and providing access to multidimensional data. It does not provide ETL kind of activities.

B. SSIS (SQL Server Integration Services) is a server for data integration and workflow applications. It is used for building and maintaining data integration workflows. It provides ETL (Extract, Transform, Load) functionalities. Therefore, this option is correct.

C. SSRS (SQL Server Reporting Services) is a server-based reporting platform that is used for creating and publishing reports. It does not provide ETL kind of activities.

D. SQL RDBMS is a relational database management system that provides the ability to store, manage, and retrieve data. It does not provide ETL kind of activities.

Therefore, the answer is:

The Answer is: B. SSIS

Which of the following causes a lock that is being held by an application using the Cursor Stability isolation level to be released?

  1. The cursor is moved to another row

  2. The row the cursor is on is deleted by the application

  3. The row the cursor is on is deleted by another application

  4. The row the cursor is on needs to be updated by another application


Correct Option: B
  1. Space Issues

  2. Data Issues

  3. No records found while querying the table

  4. Both a & b


Correct Option: A
- Hide questions