0

I have a university table that consists of prospective student information. I need to populate the email address column and the format is first_name.last_name@su.edu.

I have been trying to used the CONCAT method but every time I execute the code I run into an error stating that 'invalid number of arguements'.

SELECT CONCAT(first_name, '.', last_name, '@su.edu') AS prospect_email FROM prospect;

The expected output should be first_name.last_name@su.edu.

melpomene
  • 84,125
  • 8
  • 85
  • 148
Chris
  • 59
  • 1
  • 9

1 Answers1

0

CONCAT accepts two params, CONCAT returns first_name concatenated with '.'.

You could nest bunch of concats like

SELECT CONCAT(first_name, CONCAT('.', CONCAT(last_name, '@su.edu'))) AS prospect_email FROM prospect;

but it's easier to use concatenation operator ||:

SELECT first_name || '.'  || last_name || '@su.edu' AS prospect_email FROM prospect;

See the concat and concatenation documentation.

Dontwan
  • 121
  • 6