SQL QuestSQL Interview Questions › String Functions

Employee Display Cards (Concat)

EasyFreeQuerying BasicsString Functions

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_idnamedepartmentpositionsalaryhire_datemanager_idperformance_rating
1Alice JohnsonEngineeringSenior Developer950002019-03-1554.5
2Bob SmithEngineeringDeveloper750002020-06-0113.8
3Carol WilliamsMarketingMarketing Manager850002018-09-20NULL4.2

Expected output: card = 'Alice Johnson — Senior Developer'

Hint

The hint for this one spells out most of the query, so it stays in the editor. Reach for 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

Long-Named PassengersEasy · FreeCountry Codes in UppercaseEasy · FreeExtract Family Names (SUBSTR + INSTR)Easy · FreeYear Code from Order Date (SUBSTR)Easy · FreeMovie Title Initial Letter Histogram (SUBSTR)Easy · FreePosition of '@' in Email (INSTR)Easy · Free

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