52. Get the first_name in Employees

1. Title description

Get the first_name in Employees, query according to the last two letters of first_name, in ascending order
CREATE TABLE `employees` (
` emp_no` int (11) NOT NULL,
`birth_date` date NOT NULL,
` first_name` varchar (14) NOT NULL ,
`last_name` varchar (16) NOT NULL,
` gender` char (1) NOT NULL,
`hire_date` date NOT NULL,
PRIMARY KEY (` emp_no`));
output format:
first_name
Chirstian
Tzvetan
Bezalel
Duangkaew
Georgi
Kyoichi
Anneke
Adding up
Mary
Part
Saniya

2. Code

SELECT first_name FROM employees ORDER BY substr(first_name,length(first_name)-1);

 

 

 

Guess you like

Origin www.cnblogs.com/guoyu1/p/12720982.html