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.
Yo may try to do this aberration at your own risk:

```
INSERT INTO table (id, a, b, c) 
      VALUES ( fn_get_key( LAST_INSERT_ID("table_name ") +1), "a", "b", "c");

```

Where fn\_get\_key is a function that will convert the number into your desired string AND will execute: 

```
ALTER TABLE table_name AUTO_INCREMENT = start_value;

```

Anyway I do not recommend your approach. Numeric strings are faster and easier to sort. You could always create a view that transforms the ID or use logic o change from the "D001" key to "1". Foreing key and uniqness of ids enforcement will be harder and more expensive