mysql>
mysql> CREATE TABLE housewares2
-> (
-> id VARCHAR(20),
-> description VARCHAR(255)
-> );
mysql>
mysql> INSERT INTO housewares2 (id,description)
-> VALUES
-> ('DIN40672US', 'dining table'),
-> ('KIT372UK', 'garbage disposal'),
-> ('KIT1729JP', 'microwave oven'),
-> ('BED38SG', 'bedside lamp'),
-> ('BTH485US', 'shower stall'),
-> ('BTH415JP', 'lavatory')
-> ;
Query OK, 6 rows affected (0.00 sec)
Records: 6 Duplicates: 0 Warnings: 0
mysql>
mysql> SELECT * FROM housewares2;
+------------+------------------+
| id | description |
+------------+------------------+
| DIN40672US | dining table |
| KIT372UK | garbage disposal |
| KIT1729JP | microwave oven |
| BED38SG | bedside lamp |
| BTH485US | shower stall |
| BTH415JP | lavatory |
| DIN40672US | dining table |
| KIT372UK | garbage disposal |
| KIT1729JP | microwave oven |
| BED38SG | bedside lamp |
| BTH485US | shower stall |
| BTH415JP | lavatory |
+------------+------------------+
12 rows in set (0.00 sec)
mysql>
mysql> SELECT id, LEFT(SUBSTRING(id,4),LENGTH(SUBSTRING(id,4)-2)) FROM housewares2;
+------------+-------------------------------------------------+
| id | LEFT(SUBSTRING(id,4),LENGTH(SUBSTRING(id,4)-2)) |
+------------+-------------------------------------------------+
| DIN40672US | 40672 |
| KIT372UK | 372 |
| KIT1729JP | 1729 |
| BED38SG | 38 |
| BTH485US | 485 |
| BTH415JP | 415 |
| DIN40672US | 40672 |
| KIT372UK | 372 |
| KIT1729JP | 1729 |
| BED38SG | 38 |
| BTH485US | 485 |
| BTH415JP | 415 |
+------------+-------------------------------------------------+
12 rows in set (0.00 sec)
mysql>
mysql> drop table housewares2;
Query OK, 0 rows affected (0.00 sec)