Ahmed Selim Ahmed Selim - 5 months ago 9
SQL Question

Selecting form with SUBSTR

I have a table with name and profession I need to select the name of all employees with the first letter of their profession surrounded by () to be like:

Sara (D)
Jack (E)

MT0 MT0
Answer

Use || to concatenate strings and SUBSTR() to get the first character:

SELECT name || ' (' || SUBSTR( profession, 1,, 1 ) || ')'
FROM   your_table;
Comments