Q:

Is it possible to use next auto_increment id and insert it with a prefix with PDO?

Is it possible to use the next Auto_increment ID and concat it with a prefix, on INSERT?
In my table i have a column named id, and it's primary and auto increment. Now i'd like to save that number with a text in another column.
It would be lie this:
id   nr1      nr2   concated
-----------------------------
0    123             123_missing-0
1    234             234_missing-1
2    423      2      423_2
3    342      1      342_1
4    564             564_missing-4

Where nr2 is missing i still need a unique value, and therefore i thought of using a prefix with id Concated.
I'm using PHP, PDO and mySQL.
INSERT INTO mytable SET column2 = CONCAT("hello_", id)

A:

I would rather handle this use case while querying the database than inserting. Looks like it's being formatted for display purpose, if this is the case, you can write the SELECT query like this:
SELECT id, CONCAT("hello_", id)
FROM table;

