0
0
PostgreSQLquery~10 mins

Concatenation with || operator in PostgreSQL - 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 with a space in between.

PostgreSQL
SELECT first_name [1] ' ' [2] last_name AS full_name FROM employees;
Drag options to blanks, or click blank then click option'
A||
B+
C&
DCONCAT
Attempts:
3 left
💡 Hint
Common Mistakes
Using + instead of || for string concatenation.
Using CONCAT function without parentheses.
2fill in blank
medium

Complete the code to concatenate city and country with a comma and space between.

PostgreSQL
SELECT city [1] ', ' [2] country AS location FROM locations;
Drag options to blanks, or click blank then click option'
A||
B+
CCONCAT
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using + operator which works in some languages but not in PostgreSQL.
Forgetting spaces around the comma.
3fill in blank
hard

Fix the error in the code to concatenate first_name and last_name with a dash between.

PostgreSQL
SELECT first_name [1] '-' [2] last_name AS full_name FROM users;
Drag options to blanks, or click blank then click option'
A||
B+
CCONCAT
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using + operator which is invalid for string concatenation in PostgreSQL.
Using CONCAT without parentheses.
4fill in blank
hard

Fill both blanks to concatenate street and postal_code with a comma and space between.

PostgreSQL
SELECT street [1] ', ' [2] postal_code AS address FROM addresses;
Drag options to blanks, or click blank then click option'
A||
B+
CCONCAT
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using + operator which causes errors.
Using CONCAT without parentheses.
5fill in blank
hard

Fill all four blanks to concatenate title, first_name, and last_name with spaces between.

PostgreSQL
SELECT title [1] ' ' [2] first_name [3] ' ' [4] last_name AS full_name FROM staff;
Drag options to blanks, or click blank then click option'
A||
B+
CCONCAT
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using + or & operators which cause errors.
Using CONCAT without parentheses.