String Concatenation in SELECT
Beginner Mode

Objective

Write a SQL query to retrieve the full names of all employees by combining their first and last names. The result should include a single column named full_name, which is the concatenation of first_name and last_name separated by a space. The output should be ordered alphabetically by full_name.

Additional information

  • Table Name: employees
  • Table Schema:
Column Type Description
id INT The unique identifier for each employee
first_name VARCHAR The employee's first name
last_name VARCHAR The employee's last name
  • Output: A list of objects with a single key full_name.
  • Constraints:
    • Ensure that full_name correctly combines first_name and last_name with a space in between.
    • The results must be sorted in ascending order based on full_name.

Examples

Example 1:

Input:

employees
first_nameidlast_name
John1Smith
Mary2Johnson
James3Brown
Patricia4Davis

Output:
full_name
James Brown
John Smith
Mary Johnson
Patricia Davis
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →