Write a query to display the last 3 characters from the staffname. give an alias as name and order the results in ascending order.
Answers
Answered by
3
Let the table name is employee
Query in Oracle: select substr(trim(staffname),-3) name from employee order by name.
Note: trim() function will remove leading and trailing space.
substr(staffname,-3): function to find last three characters
Query in Oracle: select substr(trim(staffname),-3) name from employee order by name.
Note: trim() function will remove leading and trailing space.
substr(staffname,-3): function to find last three characters
Similar questions