
SQL Advance Functions MCQs

Quiz
•
Other
•
Professional Development
•
Hard
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
Similar Resources on Wayground
14 questions
Buổi 21 chuỗi kí tự

Quiz
•
Professional Development
15 questions
PEMBAYARAN KARTU

Quiz
•
Professional Development
20 questions
ERS Farm Typology

Quiz
•
Professional Development
10 questions
Turnkey 101

Quiz
•
Professional Development
15 questions
Lists and operators

Quiz
•
Professional Development
20 questions
1Z0-1093-21_01

Quiz
•
Professional Development
20 questions
RDS Exam Questions

Quiz
•
Professional Development
15 questions
Python & SQL

Quiz
•
Professional Development
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade