Bird
0
0

Consider this function:

medium📝 query result Q5 of 15
SQL - Stored Procedures and Functions
Consider this function:
CREATE FUNCTION dbo.ConcatNames(@first NVARCHAR(50), @last NVARCHAR(50)) RETURNS NVARCHAR(100) AS BEGIN RETURN @first + ' ' + @last END

What will SELECT dbo.ConcatNames('John', 'Doe'); return?
A'JohnDoe'
B'John Doe'
CError: Concatenation not allowed
DNULL
Step-by-Step Solution
Solution:
  1. Step 1: Analyze function concatenation

    The function joins first and last names with a space in between.
  2. Step 2: Apply input values

    Input 'John' and 'Doe' become 'John' + ' ' + 'Doe' = 'John Doe'.
  3. Final Answer:

    'John Doe' -> Option B
  4. Quick Check:

    Concatenation with space = 'John Doe' [OK]
Quick Trick: Use + with spaces to join strings [OK]
Common Mistakes:
  • Forgetting the space between names
  • Expecting error on string concatenation
  • Assuming NULL output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes