Question: Here I am using MySQL and I want my primary key to start with a letter, like D000. Then everytime I enter a new record the primary key auto increments like so:

D001
D002
D003.

How can I do this?

Answer: 
You can't `AUTO_INCREMENT` a column whose type is `VARCHAR`.

What you could do is make it `BIGINT` and `AUTO_INCREMENT`, and whenever you need it as `String`, you can prepend it with your letter `'D'` like:

```
Long dbKey = ...;
String key = "D" + dbKey;

```

You could create a stored procedure for this to set an "auto-incremented" string as the default value for this column, but it just doesn't worth the hassle. Plus working with numbers is always faster and more efficient than working with strings.
Two ideas.

* (Useless IMHO) I think Maria DB has *virtual columns*, though MySQL I think not. But you have *views*. So you could make a normal INT, AUTOINCREMENT and in the view have a calculated column concatting your key.
* One can use *different* **number ranges** for different tables.

```
ALTER TABLE debtors   AUTO_INCREMENT=10000;
ALTER TABLE creditors AUTO_INCREMENT=30000;
ALTER TABLE guests    AUTO_INCREMENT=50000;

```

This admittedly is a lame solution, but might do. *I think such a distinction might be what you are aiming at.*