-2

How to get only the last name by using SQL Query?

ImSahil
  • 45
  • 4

1 Answers1

1

If you are using an oracle rdbms, then you can use substr and instr functions to get the lastname from the column.

For ex.

Select substr(column_name, instr(column_name,".")) from the table_name

Note:- Assumed that dot (".") is present only once in the values.

For more reference you can refer instr documentation and substr documentation

Rajat Mishra
  • 3,635
  • 4
  • 27
  • 41