Password Generation
Write a query to display the user name and password. Password should be generated by concatenating the first three characters of the user name and the first three numbers of the phone number attribute. Give an alias name as PASSWORD. Sort the result based on the user name.
(HINT: Use users table to retrieve records.)
(Note: Evaluate only the respective query to get the desired result.
Maintain the same sequence of column order as given in the problem description)
Solution:
select name, CONCAT(substr(name,1,3),substr(phno,1,3)) as password from users order by name;