0
0
MySQLquery~10 mins

CONCAT and CONCAT_WS in MySQL - 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.

MySQL
SELECT CONCAT(first_name [1] 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 + or || instead of comma inside CONCAT.
Trying to concatenate without commas.
2fill in blank
medium

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

MySQL
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 wrong separator like '-' or ',' instead of space.
3fill in blank
hard

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

MySQL
SELECT CONCAT_WS([1], city, state) AS location FROM addresses;
Drag options to blanks, or click blank then click option'
A' , '
B';'
C','
D', '
Attempts:
3 left
💡 Hint
Common Mistakes
Using ' , ' with spaces around comma inside quotes.
Using only ',' without space.
Using wrong separator like ';'.
4fill in blank
hard

Fill both blanks to concatenate first_name, middle_name, and last_name with spaces, skipping NULL middle_name.

MySQL
SELECT CONCAT_WS([1], first_name, [2], last_name) AS full_name FROM employees;
Drag options to blanks, or click blank then click option'
A' '
Bmiddle_name
CNULL
DmiddleName
Attempts:
3 left
💡 Hint
Common Mistakes
Using NULL instead of middle_name column.
Using wrong separator like comma.
Using wrong column name like middleName.
5fill in blank
hard

Fill all three blanks to concatenate street, city, and zip code separated by commas and spaces.

MySQL
SELECT CONCAT_WS([1], street, [2], [3]) AS address FROM locations;
Drag options to blanks, or click blank then click option'
A', '
Bcity
Czip_code
Dstate
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong separator like ';'.
Using wrong column names like state instead of zip_code.
Missing commas or spaces in separator.