Ahmed Selim Ahmed Selim - 1 year ago 92
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)

Answer Source

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

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