SQL Quest › SQL Interview Questions › String Functions
Employee Display Cards (Concat)
The directory tool wants a single display string per employee instead of two separate fields. Build a column called card that combines the name and position like Alice Johnson — Senior Developer.
Show emp_id and card. Order by emp_id.
In SQLite the string concatenation operator is || (double-pipe). MySQL uses CONCAT(...), SQL Server uses +. The || form is ANSI standard and the most portable — worth using as a default unless your engine forbids it.
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
employees
| emp_id | name | department | position | salary | hire_date | manager_id | performance_rating |
|---|---|---|---|---|---|---|---|
| 1 | Alice Johnson | Engineering | Senior Developer | 95000 | 2019-03-15 | 5 | 4.5 |
| 2 | Bob Smith | Engineering | Developer | 75000 | 2020-06-01 | 1 | 3.8 |
| 3 | Carol Williams | Marketing | Marketing Manager | 85000 | 2018-09-20 | NULL | 4.2 |
Expected output: card = 'Alice Johnson — Senior Developer'
Hint
SELECT, String Functions, Concatenation, and open the hint there if you stall.Concepts
SELECT String Functions Concatenation
Practise the topic: SQL practice questions · String function practice
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test