SQL Advance Functions MCQs

SQL Advance Functions MCQs

Professional Development

15 Qs

quiz-placeholder

Similar activities

Intermediate Grammar

Intermediate Grammar

University - Professional Development

10 Qs

FinTech 07-1 SQL

FinTech 07-1 SQL

Professional Development

10 Qs

Ms-Sql-Quizz

Ms-Sql-Quizz

Professional Development

10 Qs

MsSQL Server - Quiz-3

MsSQL Server - Quiz-3

Professional Development

10 Qs

Lists and operators

Lists and operators

Professional Development

15 Qs

SQL Intermedio-Avanzado

SQL Intermedio-Avanzado

Professional Development

18 Qs

FinTech 07-3 SQL

FinTech 07-3 SQL

Professional Development

10 Qs

Data Quality - Lunch and Learn 01/08/2019

Data Quality - Lunch and Learn 01/08/2019

Professional Development

10 Qs

SQL Advance Functions MCQs

SQL Advance Functions MCQs

Assessment

Quiz

Other

Professional Development

Hard

Created by

Dinesh Kumar

Used 2+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What does the function CAST(Sales AS VARCHAR) do?

Rounds the Sales to integer

Converts Sales into a string

Trims Sales value

Encrypts Sales

Answer explanation

The function CAST(Sales AS VARCHAR) converts the Sales value from its original data type into a string format (VARCHAR). This allows for text manipulation or display, making 'Converts Sales into a string' the correct choice.

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of these is an equivalent to CAST(Sales AS INT)?

CONVERT(INT, Sales)

TO_INT(Sales)

CAST(Sales TO INT)

PARSE(Sales, INT)

Answer explanation

The function CONVERT(INT, Sales) is equivalent to CAST(Sales AS INT) in SQL, as both convert the Sales value to an integer type. The other options are either incorrect syntax or do not exist in SQL.

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What is the output of COALESCE(NULL, '', 'Hello')?

NULL

'' (empty string)

'Hello'

Error

Answer explanation

COALESCE returns the first non-null value. Here, NULL is ignored, '' (empty string) is the first non-null value, so it is returned. 'Hello' is not considered since '' is already a valid output.

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What does NVL(Sales, 0) do?

Returns NULL if Sales is 0

Returns 0 if Sales is NULL

Converts Sales to text

Deletes NULL rows

Answer explanation

NVL(Sales, 0) returns 0 when Sales is NULL, effectively replacing NULL values with 0. This is useful for calculations to avoid NULL results.

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which function aggregates values into a comma-separated string?

CONCAT_ALL

LISTAGG

GROUP_CONCAT

STRING_JOIN

Answer explanation

LISTAGG is the correct function that aggregates values into a comma-separated string in SQL. While CONCAT_ALL, GROUP_CONCAT, and STRING_JOIN are similar, LISTAGG is the standard function used for this purpose in many SQL databases.

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What does LPAD('SQL', 5, '*') return?

SQL**

**SQL

SQL

SQL

Answer explanation

LPAD('SQL', 5, '*') pads the string 'SQL' on the left with '*' until the total length is 5. Since 'SQL' is 3 characters long, it adds 2 '*' characters, resulting in '**SQL', which is the correct answer.

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which function removes spaces from the beginning of a string?

RPAD

LTRIM

RTRIM

TRIMEND

Answer explanation

The LTRIM function is specifically designed to remove spaces from the beginning of a string. In contrast, RPAD and RTRIM deal with padding and trimming spaces from the right side, while TRIMEND is not a standard function.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?