0
0
SQLquery~10 mins

CONCAT and CONCAT_WS in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to concatenate first_name and last_name without any separator.

SQL
SELECT CONCAT(first_name, [1]) AS full_name FROM employees;
Drag options to blanks, or click blank then click option'
Alast_name
B' '
CNULL
Dfirst_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using a space string instead of the last_name column.
Trying to concatenate only one column.
2fill in blank
medium

Complete the code to concatenate first_name and last_name with a space between them using CONCAT_WS.

SQL
SELECT CONCAT_WS([1], first_name, last_name) AS full_name FROM employees;
Drag options to blanks, or click blank then click option'
A'-'
B''
C' '
D','
Attempts:
3 left
💡 Hint
Common Mistakes
Using CONCAT instead of CONCAT_WS for separator.
Using no separator or wrong separator like comma.
3fill in blank
hard

Fix the error in the code to concatenate city and state with a comma and space using CONCAT_WS.

SQL
SELECT CONCAT_WS([1], city, state) AS location FROM addresses;
Drag options to blanks, or click blank then click option'
A' '
Bcity, state
Ccity + ', ' + state
D', '
Attempts:
3 left
💡 Hint
Common Mistakes
Passing multiple columns as separator.
Using plus signs for concatenation inside CONCAT_WS.
4fill in blank
hard

Fill both blanks to concatenate street, city, and state with ', ' as separator using CONCAT_WS.

SQL
SELECT CONCAT_WS([1], street, [2], state) AS full_address FROM addresses;
Drag options to blanks, or click blank then click option'
A', '
Bcity
Cstate
D' '
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong separator like space.
Putting state instead of city in second blank.
5fill in blank
hard

Fill all three blanks to concatenate first_name, middle_name, and last_name with spaces using CONCAT_WS.

SQL
SELECT CONCAT_WS([1], first_name, [2], [3]) AS full_name FROM employees;
Drag options to blanks, or click blank then click option'
A' '
Bfirst_name
Cmiddle_name
Dlast_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong separator like comma.
Mixing up column order.