DROP TABLE IF EXISTS `moo`;CREATE TABLE `moo` ( `fish` varchar(32) default NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;---- Dumping data for table `moo`--LOCK TABLES `moo` WRITE;/*!40000 ALTER TABLE `moo` DISABLE KEYS */;INSERT INTO `moo` VALUES ('fish1'),('fish1'),('fish1'),('moo1'),('moo1'),('moo1'),('moo1');/*!40000 ALTER TABLE `moo` ENABLE KEYS */;UNLOCK TABLES;/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;mysql> insert into moo values ('moo1');Query OK, 1 row affected (0.00 sec)mysql> select count(1) as npple, substring(fish,1, 3) as ra from moo group by ra order by npple;+-------+------+| npple | ra |+-------+------+| 3 | fis || 4 | moo |+-------+------+2 rows in set (0.00 sec)mysql> select count(1) as npple, substring(fish, -2, 1) as ra from moo group by ra order by npple;+-------+------+| npple | ra |+-------+------+| 7 | |+-------+------+1 row in set (0.00 sec)mysql> select substring(fish, -2, 1) from moo;+------------------------+| substring(fish, -2, 1) |+------------------------+| h || h || h || o || o || o || o |+------------------------+7 rows in set (0.00 sec)mysql> select count(1) as npple, substring(fish, -2, 1) as ra from moo group by ra order by npple;+-------+------+| npple | ra |+-------+------+| 7 | |+-------+------+1 row in set (0.00 sec)