I have a code in SQL
SELECT
NAME,
ROLL,
PHONE_NO
FROM
STUDENT
I want to add a new column with in the same extract which will have the same 9 digit phone number value but the last digit should be moved to the first place.
For example: if the value is 123456789 then the value of the new column in the same row should be 912345678
2
Answers
One approach is to use the modulus and integer division along with exponents to build the output you want:
For an explanation of the formula:
You could just use string manipulation: