Concatenate Customer Names Using || Operator
📖 Scenario: You work at a small online store. The store keeps customer first and last names in separate columns in a table called customers. You want to create a new column that shows the full name by joining the first and last names.
🎯 Goal: Build a SQL query that selects the customer ID and a new column called full_name which combines first_name and last_name using the || concatenation operator with a space between the names.
📋 What You'll Learn
Create a table called
customers with columns customer_id, first_name, and last_name.Insert three customers with exact names: (1, 'John', 'Doe'), (2, 'Jane', 'Smith'), (3, 'Alice', 'Johnson').
Write a SELECT query that concatenates
first_name and last_name with a space using the || operator.Alias the concatenated column as
full_name.💡 Why This Matters
🌍 Real World
Combining first and last names into a full name is common in customer databases, contact lists, and user profiles.
💼 Career
Knowing how to concatenate strings in SQL helps you prepare data for reports, user interfaces, and data exports.
Progress0 / 4 steps